1 ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990, 91-98, 1999 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,ppc604e,ppc620,ppc750"
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,ppc604e,ppc620,ppc750"))
56 (define_function_unit "lsu" 1 0
57 (and (eq_attr "type" "store,fpstore")
58 (eq_attr "cpu" "mpccore,ppc603,ppc604,ppc604e,ppc620,ppc750"))
61 (define_function_unit "lsu" 1 0
62 (and (eq_attr "type" "fpload")
63 (eq_attr "cpu" "mpccore,ppc603,ppc750"))
66 (define_function_unit "lsu" 1 0
67 (and (eq_attr "type" "fpload")
68 (eq_attr "cpu" "ppc604,ppc604e,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{,e} 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,ppc604e,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" "imul")
199 (eq_attr "cpu" "ppc604e"))
202 (define_function_unit "imuldiv" 1 0
203 (and (eq_attr "type" "idiv")
204 (eq_attr "cpu" "ppc604,ppc604e,ppc620"))
207 ; PPC750 has two integer units: a primary one which can perform all
208 ; operations and a secondary one which is fed in lock step with the first
209 ; and can perform "simple" integer operations.
210 ; To catch this we define a 'dummy' imuldiv-unit that is also needed
211 ; for the complex insns.
212 (define_function_unit "iu2" 2 0
213 (and (eq_attr "type" "integer")
214 (eq_attr "cpu" "ppc750"))
217 (define_function_unit "iu2" 2 0
218 (and (eq_attr "type" "imul")
219 (eq_attr "cpu" "ppc750"))
222 (define_function_unit "imuldiv" 1 0
223 (and (eq_attr "type" "imul")
224 (eq_attr "cpu" "ppc750"))
227 (define_function_unit "imuldiv" 1 0
228 (and (eq_attr "type" "idiv")
229 (eq_attr "cpu" "ppc750"))
232 ; compare is done on integer unit, but feeds insns which
233 ; execute on the branch unit.
234 (define_function_unit "iu" 1 0
235 (and (eq_attr "type" "compare")
236 (eq_attr "cpu" "rios1"))
239 (define_function_unit "iu" 1 0
240 (and (eq_attr "type" "delayed_compare")
241 (eq_attr "cpu" "rios1"))
244 (define_function_unit "iu" 1 0
245 (and (eq_attr "type" "compare,delayed_compare")
246 (eq_attr "cpu" "mpccore,ppc403,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc750"))
249 (define_function_unit "iu2" 2 0
250 (and (eq_attr "type" "compare,delayed_compare")
251 (eq_attr "cpu" "rios2"))
254 (define_function_unit "iu2" 2 0
255 (and (eq_attr "type" "compare,delayed_compare")
256 (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc750"))
259 ; fp compare uses fp unit
260 (define_function_unit "fpu" 1 0
261 (and (eq_attr "type" "fpcompare")
262 (eq_attr "cpu" "rios1"))
265 ; rios1 and rios2 have different fpcompare delays
266 (define_function_unit "fpu2" 2 0
267 (and (eq_attr "type" "fpcompare")
268 (eq_attr "cpu" "rios2"))
271 ; on ppc601 and ppc603, fpcompare takes also 2 cycles from
273 ; here we do not define delays, just occupy the unit. The dependencies
274 ; will be assigned by the fpcompare definition in the fpu.
275 (define_function_unit "iu" 1 0
276 (and (eq_attr "type" "fpcompare")
277 (eq_attr "cpu" "ppc601,ppc603"))
280 ; fp compare uses fp unit
281 (define_function_unit "fpu" 1 0
282 (and (eq_attr "type" "fpcompare")
283 (eq_attr "cpu" "ppc601,ppc603,ppc604,ppc604e,ppc620,ppc750"))
286 (define_function_unit "fpu" 1 0
287 (and (eq_attr "type" "fpcompare")
288 (eq_attr "cpu" "mpccore"))
291 (define_function_unit "bpu" 1 0
292 (and (eq_attr "type" "mtjmpr")
293 (eq_attr "cpu" "rios1,rios2"))
296 (define_function_unit "bpu" 1 0
297 (and (eq_attr "type" "mtjmpr")
298 (eq_attr "cpu" "mpccore,ppc403,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc750"))
301 ; all jumps/branches are executing on the bpu, in 1 cycle, for all machines.
302 (define_function_unit "bpu" 1 0
303 (eq_attr "type" "jmpreg")
306 (define_function_unit "bpu" 1 0
307 (eq_attr "type" "branch")
310 ; Floating Point Unit
311 (define_function_unit "fpu" 1 0
312 (and (eq_attr "type" "fp,dmul")
313 (eq_attr "cpu" "rios1"))
316 (define_function_unit "fpu" 1 0
317 (and (eq_attr "type" "fp")
318 (eq_attr "cpu" "mpccore"))
321 (define_function_unit "fpu" 1 0
322 (and (eq_attr "type" "fp")
323 (eq_attr "cpu" "ppc601"))
326 (define_function_unit "fpu" 1 0
327 (and (eq_attr "type" "fp")
328 (eq_attr "cpu" "ppc603,ppc604,ppc604e,ppc620,ppc750"))
331 (define_function_unit "fpu" 1 0
332 (and (eq_attr "type" "dmul")
333 (eq_attr "cpu" "mpccore"))
336 (define_function_unit "fpu" 1 0
337 (and (eq_attr "type" "dmul")
338 (eq_attr "cpu" "ppc601"))
342 (define_function_unit "fpu" 1 0
343 (and (eq_attr "type" "dmul")
344 (eq_attr "cpu" "ppc603,ppc750"))
347 (define_function_unit "fpu" 1 0
348 (and (eq_attr "type" "dmul")
349 (eq_attr "cpu" "ppc604,ppc604e,ppc620"))
352 (define_function_unit "fpu" 1 0
353 (and (eq_attr "type" "sdiv,ddiv")
354 (eq_attr "cpu" "rios1"))
357 (define_function_unit "fpu" 1 0
358 (and (eq_attr "type" "sdiv")
359 (eq_attr "cpu" "ppc601"))
362 (define_function_unit "fpu" 1 0
363 (and (eq_attr "type" "sdiv")
364 (eq_attr "cpu" "mpccore"))
367 (define_function_unit "fpu" 1 0
368 (and (eq_attr "type" "sdiv")
369 (eq_attr "cpu" "ppc603,ppc604,ppc604e,ppc620"))
372 (define_function_unit "fpu" 1 0
373 (and (eq_attr "type" "ddiv")
374 (eq_attr "cpu" "mpccore"))
377 (define_function_unit "fpu" 1 0
378 (and (eq_attr "type" "ddiv")
379 (eq_attr "cpu" "ppc601,ppc604,ppc604e,ppc620,ppc750"))
382 (define_function_unit "fpu" 1 0
383 (and (eq_attr "type" "ddiv")
384 (eq_attr "cpu" "ppc603"))
387 (define_function_unit "fpu" 1 0
388 (and (eq_attr "type" "ssqrt")
389 (eq_attr "cpu" "ppc620"))
392 (define_function_unit "fpu" 1 0
393 (and (eq_attr "type" "dsqrt")
394 (eq_attr "cpu" "ppc620"))
397 ; RIOS2 has two symmetric FPUs.
398 (define_function_unit "fpu2" 2 0
399 (and (eq_attr "type" "fp")
400 (eq_attr "cpu" "rios2"))
403 (define_function_unit "fpu2" 2 0
404 (and (eq_attr "type" "dmul")
405 (eq_attr "cpu" "rios2"))
408 (define_function_unit "fpu2" 2 0
409 (and (eq_attr "type" "sdiv,ddiv")
410 (eq_attr "cpu" "rios2"))
413 (define_function_unit "fpu2" 2 0
414 (and (eq_attr "type" "ssqrt,dsqrt")
415 (eq_attr "cpu" "rios2"))
419 ;; Start with fixed-point load and store insns. Here we put only the more
420 ;; complex forms. Basic data transfer is done later.
422 (define_expand "zero_extendqidi2"
423 [(set (match_operand:DI 0 "gpc_reg_operand" "")
424 (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "")))]
429 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
430 (zero_extend:DI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
435 [(set_attr "type" "load,*")])
438 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
439 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r"))
441 (clobber (match_scratch:DI 2 "=r"))]
444 [(set_attr "type" "compare")])
447 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
448 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r"))
450 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
451 (zero_extend:DI (match_dup 1)))]
454 [(set_attr "type" "compare")])
456 (define_insn "extendqidi2"
457 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
458 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
463 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
464 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r"))
466 (clobber (match_scratch:DI 2 "=r"))]
469 [(set_attr "type" "compare")])
472 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
473 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r"))
475 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
476 (sign_extend:DI (match_dup 1)))]
479 [(set_attr "type" "compare")])
481 (define_expand "zero_extendhidi2"
482 [(set (match_operand:DI 0 "gpc_reg_operand" "")
483 (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
488 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
489 (zero_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
494 [(set_attr "type" "load,*")])
497 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
498 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r"))
500 (clobber (match_scratch:DI 2 "=r"))]
503 [(set_attr "type" "compare")])
506 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
507 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r"))
509 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
510 (zero_extend:DI (match_dup 1)))]
513 [(set_attr "type" "compare")])
515 (define_expand "extendhidi2"
516 [(set (match_operand:DI 0 "gpc_reg_operand" "")
517 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
522 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
523 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
528 [(set_attr "type" "load,*")])
531 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
532 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r"))
534 (clobber (match_scratch:DI 2 "=r"))]
537 [(set_attr "type" "compare")])
540 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
541 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r"))
543 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
544 (sign_extend:DI (match_dup 1)))]
547 [(set_attr "type" "compare")])
549 (define_expand "zero_extendsidi2"
550 [(set (match_operand:DI 0 "gpc_reg_operand" "")
551 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
556 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
557 (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r")))]
562 [(set_attr "type" "load,*")])
565 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
566 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
568 (clobber (match_scratch:DI 2 "=r"))]
571 [(set_attr "type" "compare")])
574 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
575 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
577 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
578 (zero_extend:DI (match_dup 1)))]
581 [(set_attr "type" "compare")])
583 (define_expand "extendsidi2"
584 [(set (match_operand:DI 0 "gpc_reg_operand" "")
585 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
590 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
591 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
596 [(set_attr "type" "load,*")])
599 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
600 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
602 (clobber (match_scratch:DI 2 "=r"))]
605 [(set_attr "type" "compare")])
608 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
609 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
611 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
612 (sign_extend:DI (match_dup 1)))]
615 [(set_attr "type" "compare")])
617 (define_expand "zero_extendqisi2"
618 [(set (match_operand:SI 0 "gpc_reg_operand" "")
619 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
624 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
625 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
629 {rlinm|rlwinm} %0,%1,0,0xff"
630 [(set_attr "type" "load,*")])
633 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
634 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
636 (clobber (match_scratch:SI 2 "=r"))]
638 "{andil.|andi.} %2,%1,0xff"
639 [(set_attr "type" "compare")])
642 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
643 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
645 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
646 (zero_extend:SI (match_dup 1)))]
648 "{andil.|andi.} %0,%1,0xff"
649 [(set_attr "type" "compare")])
651 (define_expand "extendqisi2"
652 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
653 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
658 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
659 else if (TARGET_POWER)
660 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
662 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
666 (define_insn "extendqisi2_ppc"
667 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
668 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
673 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
674 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
676 (clobber (match_scratch:SI 2 "=r"))]
679 [(set_attr "type" "compare")])
682 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
683 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
685 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
686 (sign_extend:SI (match_dup 1)))]
689 [(set_attr "type" "compare")])
691 (define_expand "extendqisi2_power"
692 [(parallel [(set (match_dup 2)
693 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
695 (clobber (scratch:SI))])
696 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
697 (ashiftrt:SI (match_dup 2)
699 (clobber (scratch:SI))])]
702 { operands[1] = gen_lowpart (SImode, operands[1]);
703 operands[2] = gen_reg_rtx (SImode); }")
705 (define_expand "extendqisi2_no_power"
707 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
709 (set (match_operand:SI 0 "gpc_reg_operand" "")
710 (ashiftrt:SI (match_dup 2)
712 "! TARGET_POWER && ! TARGET_POWERPC"
714 { operands[1] = gen_lowpart (SImode, operands[1]);
715 operands[2] = gen_reg_rtx (SImode); }")
717 (define_expand "zero_extendqihi2"
718 [(set (match_operand:HI 0 "gpc_reg_operand" "")
719 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
724 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
725 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
729 {rlinm|rlwinm} %0,%1,0,0xff"
730 [(set_attr "type" "load,*")])
733 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
734 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r"))
736 (clobber (match_scratch:HI 2 "=r"))]
738 "{andil.|andi.} %2,%1,0xff"
739 [(set_attr "type" "compare")])
742 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
743 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r"))
745 (set (match_operand:HI 0 "gpc_reg_operand" "=r")
746 (zero_extend:HI (match_dup 1)))]
748 "{andil.|andi.} %0,%1,0xff"
749 [(set_attr "type" "compare")])
751 (define_expand "extendqihi2"
752 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
753 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
758 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
759 else if (TARGET_POWER)
760 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
762 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
766 (define_insn "extendqihi2_ppc"
767 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
768 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
773 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
774 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r"))
776 (clobber (match_scratch:HI 2 "=r"))]
779 [(set_attr "type" "compare")])
782 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
783 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r"))
785 (set (match_operand:HI 0 "gpc_reg_operand" "=r")
786 (sign_extend:HI (match_dup 1)))]
789 [(set_attr "type" "compare")])
791 (define_expand "extendqihi2_power"
792 [(parallel [(set (match_dup 2)
793 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
795 (clobber (scratch:SI))])
796 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
797 (ashiftrt:SI (match_dup 2)
799 (clobber (scratch:SI))])]
802 { operands[0] = gen_lowpart (SImode, operands[0]);
803 operands[1] = gen_lowpart (SImode, operands[1]);
804 operands[2] = gen_reg_rtx (SImode); }")
806 (define_expand "extendqihi2_no_power"
808 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
810 (set (match_operand:HI 0 "gpc_reg_operand" "")
811 (ashiftrt:SI (match_dup 2)
813 "! TARGET_POWER && ! TARGET_POWERPC"
815 { operands[0] = gen_lowpart (SImode, operands[0]);
816 operands[1] = gen_lowpart (SImode, operands[1]);
817 operands[2] = gen_reg_rtx (SImode); }")
819 (define_expand "zero_extendhisi2"
820 [(set (match_operand:SI 0 "gpc_reg_operand" "")
821 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
826 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
827 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
831 {rlinm|rlwinm} %0,%1,0,0xffff"
832 [(set_attr "type" "load,*")])
835 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
836 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
838 (clobber (match_scratch:SI 2 "=r"))]
840 "{andil.|andi.} %2,%1,0xffff"
841 [(set_attr "type" "compare")])
844 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
845 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
847 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
848 (zero_extend:SI (match_dup 1)))]
850 "{andil.|andi.} %0,%1,0xffff"
851 [(set_attr "type" "compare")])
853 (define_expand "extendhisi2"
854 [(set (match_operand:SI 0 "gpc_reg_operand" "")
855 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
860 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
861 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
866 [(set_attr "type" "load,*")])
869 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
870 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
872 (clobber (match_scratch:SI 2 "=r"))]
874 "{exts.|extsh.} %2,%1"
875 [(set_attr "type" "compare")])
878 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
879 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
881 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
882 (sign_extend:SI (match_dup 1)))]
884 "{exts.|extsh.} %0,%1"
885 [(set_attr "type" "compare")])
887 ;; Fixed-point arithmetic insns.
889 ;; Discourage ai/addic because of carry but provide it in an alternative
890 ;; allowing register zero as source.
891 (define_expand "addsi3"
892 [(set (match_operand:SI 0 "gpc_reg_operand" "")
893 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
894 (match_operand:SI 2 "reg_or_cint_operand" "")))]
898 if (GET_CODE (operands[2]) == CONST_INT && !add_operand (operands[2], SImode))
900 rtx tmp = ((reload_in_progress || reload_completed
901 || rtx_equal_p (operands[0], operands[1]))
902 ? operands[0] : gen_reg_rtx (SImode));
904 HOST_WIDE_INT low = INTVAL (operands[2]) & 0xffff;
905 HOST_WIDE_INT high = INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff);
908 high += 0x10000, low |= ((HOST_WIDE_INT) -1) << 16;
910 emit_insn (gen_addsi3 (tmp, operands[1], GEN_INT (high)));
911 emit_insn (gen_addsi3 (operands[0], tmp, GEN_INT (low)));
916 (define_insn "*addsi3_internal1"
917 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,?r,r")
918 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,b,r,b")
919 (match_operand:SI 2 "add_operand" "r,I,I,J")))]
923 {cal %0,%2(%1)|addi %0,%1,%2}
925 {cau|addis} %0,%1,%v2"
926 [(set_attr "length" "4,4,4,4")])
928 (define_insn "*addsi3_internal2"
929 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
930 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
931 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
933 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
937 {ai.|addic.} %3,%1,%2
940 [(set_attr "type" "compare")
941 (set_attr "length" "4,4,8,8")])
944 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
945 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
946 (match_operand:SI 2 "reg_or_short_operand" ""))
948 (clobber (match_scratch:SI 3 ""))]
951 (plus:SI (match_dup 1)
954 (compare:CC (match_dup 3)
958 (define_insn "*addsi3_internal3"
959 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
960 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
961 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
963 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
964 (plus:SI (match_dup 1)
969 {ai.|addic.} %0,%1,%2
972 [(set_attr "type" "compare")
973 (set_attr "length" "4,4,8,8")])
976 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
977 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
978 (match_operand:SI 2 "reg_or_short_operand" ""))
980 (set (match_operand:SI 0 "gpc_reg_operand" "")
981 (plus:SI (match_dup 1) (match_dup 2)))]
984 (plus:SI (match_dup 1)
987 (compare:CC (match_dup 0)
991 ;; Split an add that we can't do in one insn into two insns, each of which
992 ;; does one 16-bit part. This is used by combine. Note that the low-order
993 ;; add should be last in case the result gets used in an address.
996 [(set (match_operand:SI 0 "gpc_reg_operand" "")
997 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
998 (match_operand:SI 2 "non_add_cint_operand" "")))]
1000 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
1001 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
1004 HOST_WIDE_INT low = INTVAL (operands[2]) & 0xffff;
1005 HOST_WIDE_INT high = INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff);
1008 high += 0x10000, low |= ((HOST_WIDE_INT) -1) << 16;
1010 operands[3] = GEN_INT (high);
1011 operands[4] = GEN_INT (low);
1014 (define_insn "one_cmplsi2"
1015 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1016 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1021 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1022 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1024 (clobber (match_scratch:SI 2 "=r,r"))]
1029 [(set_attr "type" "compare")
1030 (set_attr "length" "4,8")])
1033 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1034 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1036 (clobber (match_scratch:SI 2 ""))]
1039 (not:SI (match_dup 1)))
1041 (compare:CC (match_dup 2)
1046 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1047 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1049 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1050 (not:SI (match_dup 1)))]
1055 [(set_attr "type" "compare")
1056 (set_attr "length" "4,8")])
1059 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1060 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1062 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1063 (not:SI (match_dup 1)))]
1066 (not:SI (match_dup 1)))
1068 (compare:CC (match_dup 0)
1073 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1074 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1075 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1077 "{sf%I1|subf%I1c} %0,%2,%1")
1080 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1081 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "r,I")
1082 (match_operand:SI 2 "gpc_reg_operand" "r,r")))]
1089 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1090 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1091 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1093 (clobber (match_scratch:SI 3 "=r,r"))]
1096 {sf.|subfc.} %3,%2,%1
1098 [(set_attr "type" "compare")
1099 (set_attr "length" "4,8")])
1102 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1103 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1104 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1106 (clobber (match_scratch:SI 3 "=r,r"))]
1111 [(set_attr "type" "compare")
1112 (set_attr "length" "4,8")])
1115 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1116 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1117 (match_operand:SI 2 "gpc_reg_operand" ""))
1119 (clobber (match_scratch:SI 3 ""))]
1122 (minus:SI (match_dup 1)
1125 (compare:CC (match_dup 3)
1130 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1131 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1132 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1134 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1135 (minus:SI (match_dup 1) (match_dup 2)))]
1138 {sf.|subfc.} %0,%2,%1
1140 [(set_attr "type" "compare")
1141 (set_attr "length" "4,8")])
1144 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1145 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1146 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1148 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1149 (minus:SI (match_dup 1)
1155 [(set_attr "type" "compare")
1156 (set_attr "length" "4,8")])
1159 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1160 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1161 (match_operand:SI 2 "gpc_reg_operand" ""))
1163 (set (match_operand:SI 0 "gpc_reg_operand" "")
1164 (minus:SI (match_dup 1)
1168 (minus:SI (match_dup 1)
1171 (compare:CC (match_dup 0)
1175 (define_expand "subsi3"
1176 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1177 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "")
1178 (match_operand:SI 2 "reg_or_cint_operand" "")))]
1182 if (GET_CODE (operands[2]) == CONST_INT)
1184 emit_insn (gen_addsi3 (operands[0], operands[1],
1185 negate_rtx (SImode, operands[2])));
1190 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1191 ;; instruction and some auxiliary computations. Then we just have a single
1192 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1195 (define_expand "sminsi3"
1197 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1198 (match_operand:SI 2 "reg_or_short_operand" ""))
1200 (minus:SI (match_dup 2) (match_dup 1))))
1201 (set (match_operand:SI 0 "gpc_reg_operand" "")
1202 (minus:SI (match_dup 2) (match_dup 3)))]
1205 { operands[3] = gen_reg_rtx (SImode); }")
1208 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1209 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1210 (match_operand:SI 2 "reg_or_short_operand" "")))
1211 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1214 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1216 (minus:SI (match_dup 2) (match_dup 1))))
1217 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1220 (define_expand "smaxsi3"
1222 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1223 (match_operand:SI 2 "reg_or_short_operand" ""))
1225 (minus:SI (match_dup 2) (match_dup 1))))
1226 (set (match_operand:SI 0 "gpc_reg_operand" "")
1227 (plus:SI (match_dup 3) (match_dup 1)))]
1230 { operands[3] = gen_reg_rtx (SImode); }")
1233 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1234 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1235 (match_operand:SI 2 "reg_or_short_operand" "")))
1236 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1239 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1241 (minus:SI (match_dup 2) (match_dup 1))))
1242 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1245 (define_expand "uminsi3"
1246 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1248 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1250 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1252 (minus:SI (match_dup 4) (match_dup 3))))
1253 (set (match_operand:SI 0 "gpc_reg_operand" "")
1254 (minus:SI (match_dup 2) (match_dup 3)))]
1258 operands[3] = gen_reg_rtx (SImode);
1259 operands[4] = gen_reg_rtx (SImode);
1260 operands[5] = GEN_INT (-2147483647 - 1);
1263 (define_expand "umaxsi3"
1264 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1266 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1268 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1270 (minus:SI (match_dup 4) (match_dup 3))))
1271 (set (match_operand:SI 0 "gpc_reg_operand" "")
1272 (plus:SI (match_dup 3) (match_dup 1)))]
1276 operands[3] = gen_reg_rtx (SImode);
1277 operands[4] = gen_reg_rtx (SImode);
1278 operands[5] = GEN_INT (-2147483647 - 1);
1282 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1283 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1284 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1286 (minus:SI (match_dup 2) (match_dup 1))))]
1291 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1293 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1294 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1296 (minus:SI (match_dup 2) (match_dup 1)))
1298 (clobber (match_scratch:SI 3 "=r"))]
1301 [(set_attr "type" "delayed_compare")])
1304 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1306 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1307 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1309 (minus:SI (match_dup 2) (match_dup 1)))
1311 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1312 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1314 (minus:SI (match_dup 2) (match_dup 1))))]
1317 [(set_attr "type" "delayed_compare")])
1319 ;; We don't need abs with condition code because such comparisons should
1321 (define_expand "abssi2"
1322 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1323 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
1329 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
1334 (define_insn "abssi2_power"
1335 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1336 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1340 (define_insn "abssi2_nopower"
1341 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1342 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
1343 (clobber (match_scratch:SI 2 "=&r,&r"))]
1347 return (TARGET_POWERPC)
1348 ? \"{srai|srawi} %2,%1,31\;xor %0,%2,%1\;subf %0,%2,%0\"
1349 : \"{srai|srawi} %2,%1,31\;xor %0,%2,%1\;{sf|subfc} %0,%2,%0\";
1351 [(set_attr "length" "12")])
1354 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1355 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
1356 (clobber (match_scratch:SI 2 "=&r,&r"))]
1357 "!TARGET_POWER && reload_completed"
1358 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1359 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1360 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
1363 (define_insn "*nabs_power"
1364 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1365 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
1369 (define_insn "*nabs_no_power"
1370 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1371 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
1372 (clobber (match_scratch:SI 2 "=&r,&r"))]
1376 return (TARGET_POWERPC)
1377 ? \"{srai|srawi} %2,%1,31\;xor %0,%2,%1\;subf %0,%0,%2\"
1378 : \"{srai|srawi} %2,%1,31\;xor %0,%2,%1\;{sf|subfc} %0,%0,%2\";
1380 [(set_attr "length" "12")])
1383 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1384 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
1385 (clobber (match_scratch:SI 2 "=&r,&r"))]
1386 "!TARGET_POWER && reload_completed"
1387 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1388 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1389 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
1392 (define_insn "negsi2"
1393 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1394 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1399 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1400 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1402 (clobber (match_scratch:SI 2 "=r"))]
1405 [(set_attr "type" "compare")])
1408 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
1409 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1411 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1412 (neg:SI (match_dup 1)))]
1415 [(set_attr "type" "compare")])
1417 (define_insn "ffssi2"
1418 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
1419 (ffs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1421 "neg %0,%1\;and %0,%0,%1\;{cntlz|cntlzw} %0,%0\;{sfi|subfic} %0,%0,32"
1422 [(set_attr "length" "16")])
1424 (define_expand "mulsi3"
1425 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1426 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1427 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
1432 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
1434 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
1438 (define_insn "mulsi3_mq"
1439 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1440 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1441 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
1442 (clobber (match_scratch:SI 3 "=q,q"))]
1445 {muls|mullw} %0,%1,%2
1446 {muli|mulli} %0,%1,%2"
1447 [(set_attr "type" "imul")])
1449 (define_insn "mulsi3_no_mq"
1450 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1451 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1452 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
1455 {muls|mullw} %0,%1,%2
1456 {muli|mulli} %0,%1,%2"
1457 [(set_attr "type" "imul")])
1460 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1461 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1462 (match_operand:SI 2 "gpc_reg_operand" "r"))
1464 (clobber (match_scratch:SI 3 "=r"))
1465 (clobber (match_scratch:SI 4 "=q"))]
1467 "{muls.|mullw.} %3,%1,%2"
1468 [(set_attr "type" "delayed_compare")])
1471 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1472 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1473 (match_operand:SI 2 "gpc_reg_operand" "r"))
1475 (clobber (match_scratch:SI 3 "=r"))]
1477 "{muls.|mullw.} %3,%1,%2"
1478 [(set_attr "type" "delayed_compare")])
1481 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1482 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1483 (match_operand:SI 2 "gpc_reg_operand" "r"))
1485 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1486 (mult:SI (match_dup 1) (match_dup 2)))
1487 (clobber (match_scratch:SI 4 "=q"))]
1489 "{muls.|mullw.} %0,%1,%2"
1490 [(set_attr "type" "delayed_compare")])
1493 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1494 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1495 (match_operand:SI 2 "gpc_reg_operand" "r"))
1497 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1498 (mult:SI (match_dup 1) (match_dup 2)))]
1500 "{muls.|mullw.} %0,%1,%2"
1501 [(set_attr "type" "delayed_compare")])
1503 ;; Operand 1 is divided by operand 2; quotient goes to operand
1504 ;; 0 and remainder to operand 3.
1505 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
1507 (define_expand "divmodsi4"
1508 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
1509 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1510 (match_operand:SI 2 "gpc_reg_operand" "")))
1511 (set (match_operand:SI 3 "gpc_reg_operand" "")
1512 (mod:SI (match_dup 1) (match_dup 2)))])]
1513 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
1516 if (! TARGET_POWER && ! TARGET_POWERPC)
1518 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1519 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1520 emit_insn (gen_divss_call ());
1521 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1522 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
1528 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1529 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1530 (match_operand:SI 2 "gpc_reg_operand" "r")))
1531 (set (match_operand:SI 3 "gpc_reg_operand" "=q")
1532 (mod:SI (match_dup 1) (match_dup 2)))]
1535 [(set_attr "type" "idiv")])
1537 (define_expand "udivsi3"
1538 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1539 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
1540 (match_operand:SI 2 "gpc_reg_operand" "")))]
1541 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
1544 if (! TARGET_POWER && ! TARGET_POWERPC)
1546 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1547 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1548 emit_insn (gen_quous_call ());
1549 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1552 else if (TARGET_POWER)
1554 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
1559 (define_insn "udivsi3_mq"
1560 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1561 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1562 (match_operand:SI 2 "gpc_reg_operand" "r")))
1563 (clobber (match_scratch:SI 3 "=q"))]
1564 "TARGET_POWERPC && TARGET_POWER"
1566 [(set_attr "type" "idiv")])
1568 (define_insn "*udivsi3_no_mq"
1569 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1570 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1571 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1572 "TARGET_POWERPC && ! TARGET_POWER"
1574 [(set_attr "type" "idiv")])
1576 ;; For powers of two we can do srai/aze for divide and then adjust for
1577 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
1578 ;; used; for PowerPC, force operands into register and do a normal divide;
1579 ;; for AIX common-mode, use quoss call on register operands.
1580 (define_expand "divsi3"
1581 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1582 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1583 (match_operand:SI 2 "reg_or_cint_operand" "")))]
1587 if (GET_CODE (operands[2]) == CONST_INT
1588 && exact_log2 (INTVAL (operands[2])) >= 0)
1590 else if (TARGET_POWERPC)
1592 operands[2] = force_reg (SImode, operands[2]);
1595 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
1599 else if (TARGET_POWER)
1603 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1604 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1605 emit_insn (gen_quoss_call ());
1606 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1611 (define_insn "divsi3_mq"
1612 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1613 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1614 (match_operand:SI 2 "gpc_reg_operand" "r")))
1615 (clobber (match_scratch:SI 3 "=q"))]
1616 "TARGET_POWERPC && TARGET_POWER"
1618 [(set_attr "type" "idiv")])
1620 (define_insn "*divsi3_no_mq"
1621 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1622 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1623 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1624 "TARGET_POWERPC && ! TARGET_POWER"
1626 [(set_attr "type" "idiv")])
1628 (define_expand "modsi3"
1629 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1630 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1631 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
1635 int i = exact_log2 (INTVAL (operands[2]));
1639 if (GET_CODE (operands[2]) != CONST_INT || i < 0)
1642 temp1 = gen_reg_rtx (SImode);
1643 temp2 = gen_reg_rtx (SImode);
1645 emit_insn (gen_divsi3 (temp1, operands[1], operands[2]));
1646 emit_insn (gen_ashlsi3 (temp2, temp1, GEN_INT (i)));
1647 emit_insn (gen_subsi3 (operands[0], operands[1], temp2));
1652 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1653 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1654 (match_operand:SI 2 "const_int_operand" "N")))]
1655 "exact_log2 (INTVAL (operands[2])) >= 0"
1656 "{srai|srawi} %0,%1,%p2\;{aze|addze} %0,%0"
1657 [(set_attr "length" "8")])
1660 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1661 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1662 (match_operand:SI 2 "const_int_operand" "N"))
1664 (clobber (match_scratch:SI 3 "=r"))]
1665 "exact_log2 (INTVAL (operands[2])) >= 0"
1666 "{srai|srawi} %3,%1,%p2\;{aze.|addze.} %3,%3"
1667 [(set_attr "type" "compare")
1668 (set_attr "length" "8")])
1671 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1672 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1673 (match_operand:SI 2 "const_int_operand" "N"))
1675 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1676 (div:SI (match_dup 1) (match_dup 2)))]
1677 "exact_log2 (INTVAL (operands[2])) >= 0"
1678 "{srai|srawi} %0,%1,%p2\;{aze.|addze.} %0,%0"
1679 [(set_attr "type" "compare")
1680 (set_attr "length" "8")])
1683 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1686 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
1688 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
1689 (match_operand:SI 3 "gpc_reg_operand" "r")))
1690 (set (match_operand:SI 2 "register_operand" "=*q")
1693 (zero_extend:DI (match_dup 1)) (const_int 32))
1694 (zero_extend:DI (match_dup 4)))
1698 [(set_attr "type" "idiv")])
1700 ;; To do unsigned divide we handle the cases of the divisor looking like a
1701 ;; negative number. If it is a constant that is less than 2**31, we don't
1702 ;; have to worry about the branches. So make a few subroutines here.
1704 ;; First comes the normal case.
1705 (define_expand "udivmodsi4_normal"
1706 [(set (match_dup 4) (const_int 0))
1707 (parallel [(set (match_operand:SI 0 "" "")
1708 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
1710 (zero_extend:DI (match_operand:SI 1 "" "")))
1711 (match_operand:SI 2 "" "")))
1712 (set (match_operand:SI 3 "" "")
1713 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
1715 (zero_extend:DI (match_dup 1)))
1719 { operands[4] = gen_reg_rtx (SImode); }")
1721 ;; This handles the branches.
1722 (define_expand "udivmodsi4_tests"
1723 [(set (match_operand:SI 0 "" "") (const_int 0))
1724 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
1725 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
1726 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
1727 (label_ref (match_operand:SI 4 "" "")) (pc)))
1728 (set (match_dup 0) (const_int 1))
1729 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
1730 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
1731 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
1732 (label_ref (match_dup 4)) (pc)))]
1735 { operands[5] = gen_reg_rtx (CCUNSmode);
1736 operands[6] = gen_reg_rtx (CCmode);
1739 (define_expand "udivmodsi4"
1740 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
1741 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
1742 (match_operand:SI 2 "reg_or_cint_operand" "")))
1743 (set (match_operand:SI 3 "gpc_reg_operand" "")
1744 (umod:SI (match_dup 1) (match_dup 2)))])]
1752 if (! TARGET_POWERPC)
1754 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1755 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1756 emit_insn (gen_divus_call ());
1757 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1758 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
1765 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
1767 operands[2] = force_reg (SImode, operands[2]);
1768 label = gen_label_rtx ();
1769 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
1770 operands[3], label));
1773 operands[2] = force_reg (SImode, operands[2]);
1775 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
1783 ;; AIX architecture-independent common-mode multiply (DImode),
1784 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
1785 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
1786 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
1787 ;; assumed unused if generating common-mode, so ignore.
1788 (define_insn "mulh_call"
1791 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
1792 (sign_extend:DI (reg:SI 4)))
1794 (clobber (match_scratch:SI 0 "=l"))]
1795 "! TARGET_POWER && ! TARGET_POWERPC"
1797 [(set_attr "type" "imul")])
1799 (define_insn "mull_call"
1801 (mult:DI (sign_extend:DI (reg:SI 3))
1802 (sign_extend:DI (reg:SI 4))))
1803 (clobber (match_scratch:SI 0 "=l"))
1804 (clobber (reg:SI 0))]
1805 "! TARGET_POWER && ! TARGET_POWERPC"
1807 [(set_attr "type" "imul")])
1809 (define_insn "divss_call"
1811 (div:SI (reg:SI 3) (reg:SI 4)))
1813 (mod:SI (reg:SI 3) (reg:SI 4)))
1814 (clobber (match_scratch:SI 0 "=l"))
1815 (clobber (reg:SI 0))]
1816 "! TARGET_POWER && ! TARGET_POWERPC"
1818 [(set_attr "type" "idiv")])
1820 (define_insn "divus_call"
1822 (udiv:SI (reg:SI 3) (reg:SI 4)))
1824 (umod:SI (reg:SI 3) (reg:SI 4)))
1825 (clobber (match_scratch:SI 0 "=l"))
1826 (clobber (reg:SI 0))
1827 (clobber (match_scratch:CC 1 "=x"))
1828 (clobber (reg:CC 69))]
1829 "! TARGET_POWER && ! TARGET_POWERPC"
1831 [(set_attr "type" "idiv")])
1833 (define_insn "quoss_call"
1835 (div:SI (reg:SI 3) (reg:SI 4)))
1836 (clobber (match_scratch:SI 0 "=l"))]
1837 "! TARGET_POWER && ! TARGET_POWERPC"
1839 [(set_attr "type" "idiv")])
1841 (define_insn "quous_call"
1843 (udiv:SI (reg:SI 3) (reg:SI 4)))
1844 (clobber (match_scratch:SI 0 "=l"))
1845 (clobber (reg:SI 0))
1846 (clobber (match_scratch:CC 1 "=x"))
1847 (clobber (reg:CC 69))]
1848 "! TARGET_POWER && ! TARGET_POWERPC"
1850 [(set_attr "type" "idiv")])
1852 ;; Logical instructions
1853 (define_insn "andsi3"
1854 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
1855 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1856 (match_operand:SI 2 "and_operand" "?r,L,K,J")))
1857 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
1861 {rlinm|rlwinm} %0,%1,0,%m2,%M2
1862 {andil.|andi.} %0,%1,%b2
1863 {andiu.|andis.} %0,%1,%u2"
1864 [(set_attr "length" "4")])
1866 ;; Note to set cr's other than cr0 we do the and immediate and then
1867 ;; the test again -- this avoids a mcrf which on the higher end
1868 ;; machines causes an execution serialization
1870 (define_insn "*andsi3_internal2"
1871 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
1872 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
1873 (match_operand:SI 2 "and_operand" "r,K,J,L,r,K,J,L"))
1875 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
1876 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
1880 {andil.|andi.} %3,%1,%b2
1881 {andiu.|andis.} %3,%1,%u2
1882 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
1887 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
1888 (set_attr "length" "4,4,4,4,8,8,8,8")])
1891 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1892 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
1893 (match_operand:SI 2 "and_operand" ""))
1895 (clobber (match_scratch:SI 3 ""))
1896 (clobber (match_scratch:CC 4 ""))]
1898 [(parallel [(set (match_dup 3)
1899 (and:SI (match_dup 1)
1901 (clobber (match_dup 4))])
1903 (compare:CC (match_dup 3)
1907 (define_insn "*andsi3_internal3"
1908 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
1909 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
1910 (match_operand:SI 2 "and_operand" "r,K,J,L,r,K,J,L"))
1912 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
1913 (and:SI (match_dup 1)
1915 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
1919 {andil.|andi.} %0,%1,%b2
1920 {andiu.|andis.} %0,%1,%u2
1921 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
1926 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
1927 (set_attr "length" "4,4,4,4,8,8,8,8")])
1930 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1931 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
1932 (match_operand:SI 2 "and_operand" ""))
1934 (set (match_operand:SI 0 "gpc_reg_operand" "")
1935 (and:SI (match_dup 1)
1937 (clobber (match_scratch:CC 4 ""))]
1939 [(parallel [(set (match_dup 0)
1940 (and:SI (match_dup 1)
1942 (clobber (match_dup 4))])
1944 (compare:CC (match_dup 0)
1948 (define_expand "iorsi3"
1949 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1950 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
1951 (match_operand:SI 2 "reg_or_cint_operand" "")))]
1955 if (GET_CODE (operands[2]) == CONST_INT
1956 && !logical_operand (operands[2], SImode))
1958 HOST_WIDE_INT value = INTVAL (operands[2]);
1959 rtx tmp = ((reload_in_progress || reload_completed
1960 || rtx_equal_p (operands[0], operands[1]))
1961 ? operands[0] : gen_reg_rtx (SImode));
1963 emit_insn (gen_iorsi3 (tmp, operands[1],
1964 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
1965 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
1970 (define_insn "*iorsi3_internal1"
1971 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
1972 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
1973 (match_operand:SI 2 "logical_operand" "r,K,J")))]
1977 {oril|ori} %0,%1,%b2
1978 {oriu|oris} %0,%1,%u2"
1979 [(set_attr "length" "4,4,4")])
1981 (define_insn "*iorsi3_internal2"
1982 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1983 (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1984 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1986 (clobber (match_scratch:SI 3 "=r,r"))]
1991 [(set_attr "type" "compare")
1992 (set_attr "length" "4,8")])
1995 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1996 (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
1997 (match_operand:SI 2 "gpc_reg_operand" ""))
1999 (clobber (match_scratch:SI 3 ""))]
2002 (ior:SI (match_dup 1)
2005 (compare:CC (match_dup 3)
2009 (define_insn "*iorsi3_internal3"
2010 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2011 (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2012 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2014 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2015 (ior:SI (match_dup 1)
2021 [(set_attr "type" "compare")
2022 (set_attr "length" "4,8")])
2025 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2026 (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2027 (match_operand:SI 2 "gpc_reg_operand" ""))
2029 (set (match_operand:SI 0 "gpc_reg_operand" "")
2030 (ior:SI (match_dup 1) (match_dup 2)))]
2033 (ior:SI (match_dup 1)
2036 (compare:CC (match_dup 0)
2040 ;; Split an IOR that we can't do in one insn into two insns, each of which
2041 ;; does one 16-bit part. This is used by combine.
2044 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2045 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2046 (match_operand:SI 2 "non_logical_cint_operand" "")))]
2048 [(set (match_dup 0) (ior:SI (match_dup 1) (match_dup 3)))
2049 (set (match_dup 0) (ior:SI (match_dup 0) (match_dup 4)))]
2052 operands[3] = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
2053 operands[4] = GEN_INT (INTVAL (operands[2]) & 0xffff);
2056 (define_expand "xorsi3"
2057 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2058 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2059 (match_operand:SI 2 "reg_or_cint_operand" "")))]
2063 if (GET_CODE (operands[2]) == CONST_INT
2064 && !logical_operand (operands[2], SImode))
2066 HOST_WIDE_INT value = INTVAL (operands[2]);
2067 rtx tmp = ((reload_in_progress || reload_completed
2068 || rtx_equal_p (operands[0], operands[1]))
2069 ? operands[0] : gen_reg_rtx (SImode));
2071 emit_insn (gen_xorsi3 (tmp, operands[1],
2072 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2073 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2078 (define_insn "*xorsi3_internal1"
2079 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2080 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
2081 (match_operand:SI 2 "logical_operand" "r,K,J")))]
2085 {xoril|xori} %0,%1,%b2
2086 {xoriu|xoris} %0,%1,%u2"
2087 [(set_attr "length" "4,4,4")])
2089 (define_insn "*xorsi3_internal2"
2090 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2091 (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2092 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2094 (clobber (match_scratch:SI 3 "=r,r"))]
2099 [(set_attr "type" "compare")
2100 (set_attr "length" "4,8")])
2103 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2104 (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2105 (match_operand:SI 2 "gpc_reg_operand" ""))
2107 (clobber (match_scratch:SI 3 ""))]
2110 (xor:SI (match_dup 1)
2113 (compare:CC (match_dup 3)
2117 (define_insn "*xorsi3_internal3"
2118 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2119 (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2120 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2122 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2123 (xor:SI (match_dup 1)
2129 [(set_attr "type" "compare")
2130 (set_attr "length" "4,8")])
2133 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2134 (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2135 (match_operand:SI 2 "gpc_reg_operand" ""))
2137 (set (match_operand:SI 0 "gpc_reg_operand" "")
2138 (xor:SI (match_dup 1) (match_dup 2)))]
2141 (xor:SI (match_dup 1)
2144 (compare:CC (match_dup 0)
2148 ;; Split an XOR that we can't do in one insn into two insns, each of which
2149 ;; does one 16-bit part. This is used by combine.
2152 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2153 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2154 (match_operand:SI 2 "non_logical_cint_operand" "")))]
2156 [(set (match_dup 0) (xor:SI (match_dup 1) (match_dup 3)))
2157 (set (match_dup 0) (xor:SI (match_dup 0) (match_dup 4)))]
2160 operands[3] = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
2161 operands[4] = GEN_INT (INTVAL (operands[2]) & 0xffff);
2164 (define_insn "*eqvsi3_internal1"
2165 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2166 (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
2167 (match_operand:SI 2 "gpc_reg_operand" "r"))))]
2171 (define_insn "*eqvsi3_internal2"
2172 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2173 (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2174 (match_operand:SI 2 "gpc_reg_operand" "r,r")))
2176 (clobber (match_scratch:SI 3 "=r,r"))]
2181 [(set_attr "type" "compare")
2182 (set_attr "length" "4,8")])
2185 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2186 (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2187 (match_operand:SI 2 "gpc_reg_operand" "")))
2189 (clobber (match_scratch:SI 3 ""))]
2192 (not:SI (xor:SI (match_dup 1)
2195 (compare:CC (match_dup 3)
2199 (define_insn "*eqvsi3_internal3"
2200 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2201 (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2202 (match_operand:SI 2 "gpc_reg_operand" "r,r")))
2204 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2205 (not:SI (xor:SI (match_dup 1) (match_dup 2))))]
2210 [(set_attr "type" "compare")
2211 (set_attr "length" "4,8")])
2214 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2215 (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2216 (match_operand:SI 2 "reg_or_short_operand" "")))
2218 (set (match_operand:SI 0 "gpc_reg_operand" "")
2219 (not:SI (xor:SI (match_dup 1)
2223 (not:SI (xor:SI (match_dup 1)
2226 (compare:CC (match_dup 0)
2230 (define_insn "*andcsi3_internal1"
2231 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2232 (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2233 (match_operand:SI 2 "gpc_reg_operand" "r")))]
2237 (define_insn "*andcsi3_internal2"
2238 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2239 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2240 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2242 (clobber (match_scratch:SI 3 "=r,r"))]
2247 [(set_attr "type" "compare")
2248 (set_attr "length" "4,8")])
2251 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2252 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2253 (match_operand:SI 2 "gpc_reg_operand" ""))
2255 (clobber (match_scratch:SI 3 ""))]
2258 (and:SI (not:SI (match_dup 1))
2261 (compare:CC (match_dup 3)
2265 (define_insn "*andcsi3_internal3"
2266 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2267 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2268 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2270 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2271 (and:SI (not:SI (match_dup 1))
2277 [(set_attr "type" "compare")
2278 (set_attr "length" "4,8")])
2281 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2282 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2283 (match_operand:SI 2 "gpc_reg_operand" ""))
2285 (set (match_operand:SI 0 "gpc_reg_operand" "")
2286 (and:SI (not:SI (match_dup 1))
2290 (and:SI (not:SI (match_dup 1))
2293 (compare:CC (match_dup 0)
2297 (define_insn "*iorcsi3_internal1"
2298 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2299 (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2300 (match_operand:SI 2 "gpc_reg_operand" "r")))]
2304 (define_insn "*iorcsi3_internal2"
2305 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2306 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2307 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2309 (clobber (match_scratch:SI 3 "=r,r"))]
2314 [(set_attr "type" "compare")
2315 (set_attr "length" "4,8")])
2318 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2319 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2320 (match_operand:SI 2 "gpc_reg_operand" ""))
2322 (clobber (match_scratch:SI 3 ""))]
2325 (ior:SI (not:SI (match_dup 1))
2328 (compare:CC (match_dup 3)
2332 (define_insn "*iorcsi3_internal3"
2333 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2334 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2335 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2337 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2338 (ior:SI (not:SI (match_dup 1)) (match_dup 2)))]
2343 [(set_attr "type" "compare")])
2346 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2347 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2348 (match_operand:SI 2 "gpc_reg_operand" ""))
2350 (set (match_operand:SI 0 "gpc_reg_operand" "")
2351 (ior:SI (not:SI (match_dup 1))
2355 (ior:SI (not:SI (match_dup 1))
2358 (compare:CC (match_dup 0)
2362 (define_insn "*nandsi3_internal1"
2363 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2364 (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2365 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
2369 (define_insn "*nandsi3_internal2"
2370 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2371 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2372 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")))
2374 (clobber (match_scratch:SI 3 "=r,r"))]
2379 [(set_attr "type" "compare")
2380 (set_attr "length" "4,8")])
2383 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2384 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2385 (not:SI (match_operand:SI 2 "gpc_reg_operand" "")))
2387 (clobber (match_scratch:SI 3 ""))]
2390 (ior:SI (not:SI (match_dup 1))
2391 (not:SI (match_dup 2))))
2393 (compare:CC (match_dup 3)
2397 (define_insn "*nandsi3_internal3"
2398 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2399 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2400 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")))
2402 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2403 (ior:SI (not:SI (match_dup 1))
2404 (not:SI (match_dup 2))))]
2409 [(set_attr "type" "compare")
2410 (set_attr "length" "4,8")])
2413 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2414 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2415 (not:SI (match_operand:SI 2 "gpc_reg_operand" "")))
2417 (set (match_operand:SI 0 "gpc_reg_operand" "")
2418 (ior:SI (not:SI (match_dup 1))
2419 (not:SI (match_dup 2))))]
2422 (ior:SI (not:SI (match_dup 1))
2423 (not:SI (match_dup 2))))
2425 (compare:CC (match_dup 0)
2429 (define_insn "*norsi3_internal1"
2430 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2431 (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2432 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
2436 (define_insn "*norsi3_internal2"
2437 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2438 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2439 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")))
2441 (clobber (match_scratch:SI 3 "=r,r"))]
2446 [(set_attr "type" "compare")
2447 (set_attr "length" "4,8")])
2450 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2451 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2452 (not:SI (match_operand:SI 2 "gpc_reg_operand" "")))
2454 (clobber (match_scratch:SI 3 ""))]
2457 (and:SI (not:SI (match_dup 1))
2458 (not:SI (match_dup 2))))
2460 (compare:CC (match_dup 3)
2464 (define_insn "*norsi3_internal3"
2465 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2466 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2467 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")))
2469 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2470 (and:SI (not:SI (match_dup 1))
2471 (not:SI (match_dup 2))))]
2476 [(set_attr "type" "compare")
2477 (set_attr "length" "4,8")])
2480 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2481 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2482 (not:SI (match_operand:SI 2 "gpc_reg_operand" "")))
2484 (set (match_operand:SI 0 "gpc_reg_operand" "")
2485 (and:SI (not:SI (match_dup 1))
2486 (not:SI (match_dup 2))))]
2489 (and:SI (not:SI (match_dup 1))
2490 (not:SI (match_dup 2))))
2492 (compare:CC (match_dup 0)
2496 ;; maskir insn. We need four forms because things might be in arbitrary
2497 ;; orders. Don't define forms that only set CR fields because these
2498 ;; would modify an input register.
2500 (define_insn "*maskir_internal1"
2501 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2502 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2503 (match_operand:SI 1 "gpc_reg_operand" "0"))
2504 (and:SI (match_dup 2)
2505 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
2509 (define_insn "*maskir_internal2"
2510 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2511 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2512 (match_operand:SI 1 "gpc_reg_operand" "0"))
2513 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2518 (define_insn "*maskir_internal3"
2519 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2520 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2521 (match_operand:SI 3 "gpc_reg_operand" "r"))
2522 (and:SI (not:SI (match_dup 2))
2523 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2527 (define_insn "*maskir_internal4"
2528 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2529 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2530 (match_operand:SI 2 "gpc_reg_operand" "r"))
2531 (and:SI (not:SI (match_dup 2))
2532 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2536 (define_insn "*maskir_internal5"
2537 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2539 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2540 (match_operand:SI 1 "gpc_reg_operand" "0"))
2541 (and:SI (match_dup 2)
2542 (match_operand:SI 3 "gpc_reg_operand" "r")))
2544 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2545 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2546 (and:SI (match_dup 2) (match_dup 3))))]
2549 [(set_attr "type" "compare")])
2551 (define_insn "*maskir_internal6"
2552 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2554 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2555 (match_operand:SI 1 "gpc_reg_operand" "0"))
2556 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2559 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2560 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2561 (and:SI (match_dup 3) (match_dup 2))))]
2564 [(set_attr "type" "compare")])
2566 (define_insn "*maskir_internal7"
2567 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2569 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2570 (match_operand:SI 3 "gpc_reg_operand" "r"))
2571 (and:SI (not:SI (match_dup 2))
2572 (match_operand:SI 1 "gpc_reg_operand" "0")))
2574 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2575 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2576 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2579 [(set_attr "type" "compare")])
2581 (define_insn "*maskir_internal8"
2582 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2584 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2585 (match_operand:SI 2 "gpc_reg_operand" "r"))
2586 (and:SI (not:SI (match_dup 2))
2587 (match_operand:SI 1 "gpc_reg_operand" "0")))
2589 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2590 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2591 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2594 [(set_attr "type" "compare")])
2596 ;; Rotate and shift insns, in all their variants. These support shifts,
2597 ;; field inserts and extracts, and various combinations thereof.
2598 (define_expand "insv"
2599 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2600 (match_operand:SI 1 "const_int_operand" "i")
2601 (match_operand:SI 2 "const_int_operand" "i"))
2602 (match_operand:SI 3 "gpc_reg_operand" "r"))]
2606 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
2607 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
2608 compiler if the address of the structure is taken later. */
2609 if (GET_CODE (operands[0]) == SUBREG
2610 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
2615 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2616 (match_operand:SI 1 "const_int_operand" "i")
2617 (match_operand:SI 2 "const_int_operand" "i"))
2618 (match_operand:SI 3 "gpc_reg_operand" "r"))]
2622 int start = INTVAL (operands[2]) & 31;
2623 int size = INTVAL (operands[1]) & 31;
2625 operands[4] = GEN_INT (32 - start - size);
2626 operands[1] = GEN_INT (start + size - 1);
2627 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2631 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2632 (match_operand:SI 1 "const_int_operand" "i")
2633 (match_operand:SI 2 "const_int_operand" "i"))
2634 (ashift:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2635 (match_operand:SI 4 "const_int_operand" "i")))]
2636 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2639 int shift = INTVAL (operands[4]) & 31;
2640 int start = INTVAL (operands[2]) & 31;
2641 int size = INTVAL (operands[1]) & 31;
2643 operands[4] = GEN_INT (shift - start - size);
2644 operands[1] = GEN_INT (start + size - 1);
2645 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2649 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2650 (match_operand:SI 1 "const_int_operand" "i")
2651 (match_operand:SI 2 "const_int_operand" "i"))
2652 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2653 (match_operand:SI 4 "const_int_operand" "i")))]
2654 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2657 int shift = INTVAL (operands[4]) & 31;
2658 int start = INTVAL (operands[2]) & 31;
2659 int size = INTVAL (operands[1]) & 31;
2661 operands[4] = GEN_INT (32 - shift - start - size);
2662 operands[1] = GEN_INT (start + size - 1);
2663 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2667 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2668 (match_operand:SI 1 "const_int_operand" "i")
2669 (match_operand:SI 2 "const_int_operand" "i"))
2670 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2671 (match_operand:SI 4 "const_int_operand" "i")))]
2672 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2675 int shift = INTVAL (operands[4]) & 31;
2676 int start = INTVAL (operands[2]) & 31;
2677 int size = INTVAL (operands[1]) & 31;
2679 operands[4] = GEN_INT (32 - shift - start - size);
2680 operands[1] = GEN_INT (start + size - 1);
2681 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2685 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2686 (match_operand:SI 1 "const_int_operand" "i")
2687 (match_operand:SI 2 "const_int_operand" "i"))
2688 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2689 (match_operand:SI 4 "const_int_operand" "i")
2690 (match_operand:SI 5 "const_int_operand" "i")))]
2691 "INTVAL (operands[4]) >= INTVAL (operands[1])"
2694 int extract_start = INTVAL (operands[5]) & 31;
2695 int extract_size = INTVAL (operands[4]) & 31;
2696 int insert_start = INTVAL (operands[2]) & 31;
2697 int insert_size = INTVAL (operands[1]) & 31;
2699 /* Align extract field with insert field */
2700 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
2701 operands[1] = GEN_INT (insert_start + insert_size - 1);
2702 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
2706 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
2707 (match_operand:DI 1 "const_int_operand" "i")
2708 (match_operand:DI 2 "const_int_operand" "i"))
2709 (match_operand:DI 3 "gpc_reg_operand" "r"))]
2713 int start = INTVAL (operands[2]) & 63;
2714 int size = INTVAL (operands[1]) & 63;
2716 operands[2] = GEN_INT (64 - start - size);
2717 return \"rldimi %0,%3,%H2,%H1\";
2720 (define_expand "extzv"
2721 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2722 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2723 (match_operand:SI 2 "const_int_operand" "i")
2724 (match_operand:SI 3 "const_int_operand" "i")))]
2728 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
2729 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
2730 compiler if the address of the structure is taken later. */
2731 if (GET_CODE (operands[0]) == SUBREG
2732 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
2737 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2738 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2739 (match_operand:SI 2 "const_int_operand" "i")
2740 (match_operand:SI 3 "const_int_operand" "i")))]
2744 int start = INTVAL (operands[3]) & 31;
2745 int size = INTVAL (operands[2]) & 31;
2747 if (start + size >= 32)
2748 operands[3] = const0_rtx;
2750 operands[3] = GEN_INT (start + size);
2751 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
2755 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2756 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2757 (match_operand:SI 2 "const_int_operand" "i")
2758 (match_operand:SI 3 "const_int_operand" "i"))
2760 (clobber (match_scratch:SI 4 "=r"))]
2764 int start = INTVAL (operands[3]) & 31;
2765 int size = INTVAL (operands[2]) & 31;
2767 /* If the bitfield being tested fits in the upper or lower half of a
2768 word, it is possible to use andiu. or andil. to test it. This is
2769 useful because the condition register set-use delay is smaller for
2770 andi[ul]. than for rlinm. This doesn't work when the starting bit
2771 position is 0 because the LT and GT bits may be set wrong. */
2773 if ((start > 0 && start + size <= 16) || start >= 16)
2775 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
2776 - (1 << (16 - (start & 15) - size))));
2778 return \"{andiu.|andis.} %4,%1,%3\";
2780 return \"{andil.|andi.} %4,%1,%3\";
2783 if (start + size >= 32)
2784 operands[3] = const0_rtx;
2786 operands[3] = GEN_INT (start + size);
2787 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
2789 [(set_attr "type" "compare")])
2792 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2793 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2794 (match_operand:SI 2 "const_int_operand" "i")
2795 (match_operand:SI 3 "const_int_operand" "i"))
2797 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2798 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
2802 int start = INTVAL (operands[3]) & 31;
2803 int size = INTVAL (operands[2]) & 31;
2805 if (start >= 16 && start + size == 32)
2807 operands[3] = GEN_INT ((1 << (32 - start)) - 1);
2808 return \"{andil.|andi.} %0,%1,%3\";
2811 if (start + size >= 32)
2812 operands[3] = const0_rtx;
2814 operands[3] = GEN_INT (start + size);
2815 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
2817 [(set_attr "type" "delayed_compare")])
2820 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2821 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
2822 (match_operand:DI 2 "const_int_operand" "i")
2823 (match_operand:DI 3 "const_int_operand" "i")))]
2827 int start = INTVAL (operands[3]) & 63;
2828 int size = INTVAL (operands[2]) & 63;
2830 if (start + size >= 64)
2831 operands[3] = const0_rtx;
2833 operands[3] = GEN_INT (start + size);
2834 operands[2] = GEN_INT (64 - size);
2835 return \"rldicl %0,%1,%3,%2\";
2839 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
2840 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
2841 (match_operand:DI 2 "const_int_operand" "i")
2842 (match_operand:DI 3 "const_int_operand" "i"))
2844 (clobber (match_scratch:DI 4 "=r"))]
2848 int start = INTVAL (operands[3]) & 63;
2849 int size = INTVAL (operands[2]) & 63;
2851 if (start + size >= 64)
2852 operands[3] = const0_rtx;
2854 operands[3] = GEN_INT (start + size);
2855 operands[2] = GEN_INT (64 - size);
2856 return \"rldicl. %4,%1,%3,%2\";
2860 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
2861 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
2862 (match_operand:DI 2 "const_int_operand" "i")
2863 (match_operand:DI 3 "const_int_operand" "i"))
2865 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
2866 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
2870 int start = INTVAL (operands[3]) & 63;
2871 int size = INTVAL (operands[2]) & 63;
2873 if (start + size >= 64)
2874 operands[3] = const0_rtx;
2876 operands[3] = GEN_INT (start + size);
2877 operands[2] = GEN_INT (64 - size);
2878 return \"rldicl. %0,%1,%3,%2\";
2881 (define_insn "rotlsi3"
2882 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2883 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2884 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
2886 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
2888 (define_insn "*rotlsi3_internal2"
2889 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2890 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2891 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2893 (clobber (match_scratch:SI 3 "=r"))]
2895 "{rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff"
2896 [(set_attr "type" "delayed_compare")])
2898 (define_insn "*rotlsi3_internal3"
2899 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2900 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2901 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2903 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2904 (rotate:SI (match_dup 1) (match_dup 2)))]
2906 "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff"
2907 [(set_attr "type" "delayed_compare")])
2909 (define_insn "*rotlsi3_internal4"
2910 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2911 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2912 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2913 (match_operand:SI 3 "mask_operand" "L")))]
2915 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
2917 (define_insn "*rotlsi3_internal5"
2918 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2920 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2921 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2922 (match_operand:SI 3 "mask_operand" "L"))
2924 (clobber (match_scratch:SI 4 "=r"))]
2926 "{rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3"
2927 [(set_attr "type" "delayed_compare")])
2929 (define_insn "*rotlsi3_internal6"
2930 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2932 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2933 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2934 (match_operand:SI 3 "mask_operand" "L"))
2936 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2937 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
2939 "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3"
2940 [(set_attr "type" "delayed_compare")])
2942 (define_insn "*rotlsi3_internal7"
2943 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2946 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2947 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
2949 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
2951 (define_insn "*rotlsi3_internal8"
2952 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2953 (compare:CC (zero_extend:SI
2955 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2956 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
2958 (clobber (match_scratch:SI 3 "=r"))]
2960 "{rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff"
2961 [(set_attr "type" "delayed_compare")])
2963 (define_insn "*rotlsi3_internal9"
2964 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2965 (compare:CC (zero_extend:SI
2967 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2968 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
2970 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2971 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
2973 "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff"
2974 [(set_attr "type" "delayed_compare")])
2976 (define_insn "*rotlsi3_internal10"
2977 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2980 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2981 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
2983 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
2985 (define_insn "*rotlsi3_internal11"
2986 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2987 (compare:CC (zero_extend:SI
2989 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2990 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
2992 (clobber (match_scratch:SI 3 "=r"))]
2994 "{rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff"
2995 [(set_attr "type" "delayed_compare")])
2997 (define_insn "*rotlsi3_internal12"
2998 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2999 (compare:CC (zero_extend:SI
3001 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3002 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
3004 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
3005 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3007 "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff"
3008 [(set_attr "type" "delayed_compare")])
3010 ;; Note that we use "sle." instead of "sl." so that we can set
3011 ;; SHIFT_COUNT_TRUNCATED.
3013 (define_expand "ashlsi3"
3014 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3015 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3016 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3021 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
3023 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
3027 (define_insn "ashlsi3_power"
3028 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3029 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3030 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
3031 (clobber (match_scratch:SI 3 "=q,X"))]
3035 {sli|slwi} %0,%1,%h2"
3036 [(set_attr "length" "8")])
3038 (define_insn "ashlsi3_no_power"
3039 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3040 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3041 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3043 "{sl|slw}%I2 %0,%1,%h2"
3044 [(set_attr "length" "8")])
3047 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
3048 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3049 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
3051 (clobber (match_scratch:SI 3 "=r,r"))
3052 (clobber (match_scratch:SI 4 "=q,X"))]
3056 {sli.|slwi.} %3,%1,%h2"
3057 [(set_attr "type" "delayed_compare")])
3060 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
3061 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3062 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
3064 (clobber (match_scratch:SI 3 "=r"))]
3066 "{sl|slw}%I2. %3,%1,%h2"
3067 [(set_attr "type" "delayed_compare")])
3070 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
3071 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3072 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
3074 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3075 (ashift:SI (match_dup 1) (match_dup 2)))
3076 (clobber (match_scratch:SI 4 "=q,X"))]
3080 {sli.|slwi.} %0,%1,%h2"
3081 [(set_attr "type" "delayed_compare")])
3084 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
3085 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3086 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
3088 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
3089 (ashift:SI (match_dup 1) (match_dup 2)))]
3091 "{sl|slw}%I2. %0,%1,%h2"
3092 [(set_attr "type" "delayed_compare")])
3095 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3096 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3097 (match_operand:SI 2 "const_int_operand" "i"))
3098 (match_operand:SI 3 "mask_operand" "L")))]
3099 "includes_lshift_p (operands[2], operands[3])"
3100 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
3103 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
3105 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3106 (match_operand:SI 2 "const_int_operand" "i"))
3107 (match_operand:SI 3 "mask_operand" "L"))
3109 (clobber (match_scratch:SI 4 "=r"))]
3110 "includes_lshift_p (operands[2], operands[3])"
3111 "{rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3"
3112 [(set_attr "type" "delayed_compare")])
3115 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
3117 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3118 (match_operand:SI 2 "const_int_operand" "i"))
3119 (match_operand:SI 3 "mask_operand" "L"))
3121 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
3122 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3123 "includes_lshift_p (operands[2], operands[3])"
3124 "{rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3"
3125 [(set_attr "type" "delayed_compare")])
3127 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
3129 (define_expand "lshrsi3"
3130 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3131 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3132 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3137 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
3139 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
3143 (define_insn "lshrsi3_power"
3144 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3145 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
3146 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
3147 (clobber (match_scratch:SI 3 "=q,X,X"))]
3152 {s%A2i|s%A2wi} %0,%1,%h2")
3154 (define_insn "lshrsi3_no_power"
3155 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3156 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3157 (match_operand:SI 2 "reg_or_cint_operand" "O,ri")))]
3161 {sr|srw}%I2 %0,%1,%h2")
3164 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x")
3165 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
3166 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i"))
3168 (clobber (match_scratch:SI 3 "=r,X,r"))
3169 (clobber (match_scratch:SI 4 "=q,X,X"))]
3174 {s%A2i.|s%A2wi.} %3,%1,%h2"
3175 [(set_attr "type" "delayed_compare")])
3178 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
3179 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3180 (match_operand:SI 2 "reg_or_cint_operand" "O,ri"))
3182 (clobber (match_scratch:SI 3 "=X,r"))]
3186 {sr|srw}%I2. %3,%1,%h2"
3187 [(set_attr "type" "delayed_compare")])
3190 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x")
3191 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
3192 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i"))
3194 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3195 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3196 (clobber (match_scratch:SI 4 "=q,X,X"))]
3201 {s%A2i.|s%A2wi.} %0,%1,%h2"
3202 [(set_attr "type" "delayed_compare")])
3205 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
3206 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3207 (match_operand:SI 2 "reg_or_cint_operand" "O,ri"))
3209 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3210 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
3214 {sr|srw}%I2. %0,%1,%h2"
3215 [(set_attr "type" "delayed_compare")])
3218 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3219 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3220 (match_operand:SI 2 "const_int_operand" "i"))
3221 (match_operand:SI 3 "mask_operand" "L")))]
3222 "includes_rshift_p (operands[2], operands[3])"
3223 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
3226 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
3228 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3229 (match_operand:SI 2 "const_int_operand" "i"))
3230 (match_operand:SI 3 "mask_operand" "L"))
3232 (clobber (match_scratch:SI 4 "=r"))]
3233 "includes_rshift_p (operands[2], operands[3])"
3234 "{rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3"
3235 [(set_attr "type" "delayed_compare")])
3238 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
3240 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3241 (match_operand:SI 2 "const_int_operand" "i"))
3242 (match_operand:SI 3 "mask_operand" "L"))
3244 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
3245 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3246 "includes_rshift_p (operands[2], operands[3])"
3247 "{rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3"
3248 [(set_attr "type" "delayed_compare")])
3251 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3254 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3255 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
3256 "includes_rshift_p (operands[2], GEN_INT (255))"
3257 "{rlinm|rlwinm} %0,%1,%s2,0xff")
3260 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
3264 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3265 (match_operand:SI 2 "const_int_operand" "i")) 0))
3267 (clobber (match_scratch:SI 3 "=r"))]
3268 "includes_rshift_p (operands[2], GEN_INT (255))"
3269 "{rlinm.|rlwinm.} %3,%1,%s2,0xff"
3270 [(set_attr "type" "delayed_compare")])
3273 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
3277 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3278 (match_operand:SI 2 "const_int_operand" "i")) 0))
3280 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
3281 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
3282 "includes_rshift_p (operands[2], GEN_INT (255))"
3283 "{rlinm.|rlwinm.} %0,%1,%s2,0xff"
3284 [(set_attr "type" "delayed_compare")])
3287 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3290 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3291 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
3292 "includes_rshift_p (operands[2], GEN_INT (65535))"
3293 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
3296 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
3300 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3301 (match_operand:SI 2 "const_int_operand" "i")) 0))
3303 (clobber (match_scratch:SI 3 "=r"))]
3304 "includes_rshift_p (operands[2], GEN_INT (65535))"
3305 "{rlinm.|rlwinm.} %3,%1,%s2,0xffff"
3306 [(set_attr "type" "delayed_compare")])
3309 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
3313 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3314 (match_operand:SI 2 "const_int_operand" "i")) 0))
3316 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
3317 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
3318 "includes_rshift_p (operands[2], GEN_INT (65535))"
3319 "{rlinm.|rlwinm.} %0,%1,%s2,0xffff"
3320 [(set_attr "type" "delayed_compare")])
3323 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3325 (match_operand:SI 1 "gpc_reg_operand" "r"))
3326 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3332 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3334 (match_operand:SI 1 "gpc_reg_operand" "r"))
3335 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3341 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3343 (match_operand:SI 1 "gpc_reg_operand" "r"))
3344 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3350 (define_expand "ashrsi3"
3351 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3352 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3353 (match_operand:SI 2 "reg_or_cint_operand" "")))]
3358 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
3360 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
3364 (define_insn "ashrsi3_power"
3365 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3366 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3367 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
3368 (clobber (match_scratch:SI 3 "=q,X"))]
3372 {srai|srawi} %0,%1,%h2")
3374 (define_insn "ashrsi3_no_power"
3375 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3376 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3377 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3379 "{sra|sraw}%I2 %0,%1,%h2")
3382 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
3383 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3384 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
3386 (clobber (match_scratch:SI 3 "=r,r"))
3387 (clobber (match_scratch:SI 4 "=q,X"))]
3391 {srai.|srawi.} %3,%1,%h2"
3392 [(set_attr "type" "delayed_compare")])
3395 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
3396 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3397 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
3399 (clobber (match_scratch:SI 3 "=r"))]
3401 "{sra|sraw}%I2. %3,%1,%h2"
3402 [(set_attr "type" "delayed_compare")])
3405 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
3406 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3407 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
3409 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3410 (ashiftrt:SI (match_dup 1) (match_dup 2)))
3411 (clobber (match_scratch:SI 4 "=q,X"))]
3415 {srai.|srawi.} %0,%1,%h2"
3416 [(set_attr "type" "delayed_compare")])
3419 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
3420 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3421 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
3423 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
3424 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
3426 "{sra|sraw}%I2. %0,%1,%h2"
3427 [(set_attr "type" "delayed_compare")])
3429 ;; Floating-point insns, excluding normal data motion.
3431 ;; PowerPC has a full set of single-precision floating point instructions.
3433 ;; For the POWER architecture, we pretend that we have both SFmode and
3434 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
3435 ;; The only conversions we will do will be when storing to memory. In that
3436 ;; case, we will use the "frsp" instruction before storing.
3438 ;; Note that when we store into a single-precision memory location, we need to
3439 ;; use the frsp insn first. If the register being stored isn't dead, we
3440 ;; need a scratch register for the frsp. But this is difficult when the store
3441 ;; is done by reload. It is not incorrect to do the frsp on the register in
3442 ;; this case, we just lose precision that we would have otherwise gotten but
3443 ;; is not guaranteed. Perhaps this should be tightened up at some point.
3445 (define_insn "extendsfdf2"
3446 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3447 (float_extend:DF (match_operand:SF 1 "gpc_reg_operand" "f")))]
3451 if (REGNO (operands[0]) == REGNO (operands[1]))
3454 return \"fmr %0,%1\";
3456 [(set_attr "type" "fp")])
3458 (define_insn "truncdfsf2"
3459 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3460 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
3463 [(set_attr "type" "fp")])
3465 (define_insn "aux_truncdfsf2"
3466 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3467 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] 0))]
3468 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
3470 [(set_attr "type" "fp")])
3472 (define_insn "negsf2"
3473 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3474 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
3477 [(set_attr "type" "fp")])
3479 (define_insn "abssf2"
3480 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3481 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
3484 [(set_attr "type" "fp")])
3487 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3488 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
3491 [(set_attr "type" "fp")])
3493 (define_expand "addsf3"
3494 [(set (match_operand:SF 0 "gpc_reg_operand" "")
3495 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
3496 (match_operand:SF 2 "gpc_reg_operand" "")))]
3501 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3502 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3503 (match_operand:SF 2 "gpc_reg_operand" "f")))]
3504 "TARGET_POWERPC && TARGET_HARD_FLOAT"
3506 [(set_attr "type" "fp")])
3509 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3510 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3511 (match_operand:SF 2 "gpc_reg_operand" "f")))]
3512 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
3513 "{fa|fadd} %0,%1,%2"
3514 [(set_attr "type" "fp")])
3516 (define_expand "subsf3"
3517 [(set (match_operand:SF 0 "gpc_reg_operand" "")
3518 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
3519 (match_operand:SF 2 "gpc_reg_operand" "")))]
3524 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3525 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
3526 (match_operand:SF 2 "gpc_reg_operand" "f")))]
3527 "TARGET_POWERPC && TARGET_HARD_FLOAT"
3529 [(set_attr "type" "fp")])
3532 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3533 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
3534 (match_operand:SF 2 "gpc_reg_operand" "f")))]
3535 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
3536 "{fs|fsub} %0,%1,%2"
3537 [(set_attr "type" "fp")])
3539 (define_expand "mulsf3"
3540 [(set (match_operand:SF 0 "gpc_reg_operand" "")
3541 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
3542 (match_operand:SF 2 "gpc_reg_operand" "")))]
3547 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3548 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3549 (match_operand:SF 2 "gpc_reg_operand" "f")))]
3550 "TARGET_POWERPC && TARGET_HARD_FLOAT"
3552 [(set_attr "type" "fp")])
3555 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3556 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3557 (match_operand:SF 2 "gpc_reg_operand" "f")))]
3558 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
3559 "{fm|fmul} %0,%1,%2"
3560 [(set_attr "type" "dmul")])
3562 (define_expand "divsf3"
3563 [(set (match_operand:SF 0 "gpc_reg_operand" "")
3564 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
3565 (match_operand:SF 2 "gpc_reg_operand" "")))]
3570 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3571 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
3572 (match_operand:SF 2 "gpc_reg_operand" "f")))]
3573 "TARGET_POWERPC && TARGET_HARD_FLOAT"
3575 [(set_attr "type" "sdiv")])
3578 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3579 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
3580 (match_operand:SF 2 "gpc_reg_operand" "f")))]
3581 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
3582 "{fd|fdiv} %0,%1,%2"
3583 [(set_attr "type" "ddiv")])
3586 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3587 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3588 (match_operand:SF 2 "gpc_reg_operand" "f"))
3589 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3590 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3591 "fmadds %0,%1,%2,%3"
3592 [(set_attr "type" "fp")])
3595 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3596 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3597 (match_operand:SF 2 "gpc_reg_operand" "f"))
3598 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3599 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3600 "{fma|fmadd} %0,%1,%2,%3"
3601 [(set_attr "type" "dmul")])
3604 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3605 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3606 (match_operand:SF 2 "gpc_reg_operand" "f"))
3607 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3608 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3609 "fmsubs %0,%1,%2,%3"
3610 [(set_attr "type" "fp")])
3613 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3614 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3615 (match_operand:SF 2 "gpc_reg_operand" "f"))
3616 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3617 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3618 "{fms|fmsub} %0,%1,%2,%3"
3619 [(set_attr "type" "dmul")])
3622 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3623 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3624 (match_operand:SF 2 "gpc_reg_operand" "f"))
3625 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
3626 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3627 "fnmadds %0,%1,%2,%3"
3628 [(set_attr "type" "fp")])
3631 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3632 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3633 (match_operand:SF 2 "gpc_reg_operand" "f"))
3634 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
3635 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3636 "{fnma|fnmadd} %0,%1,%2,%3"
3637 [(set_attr "type" "dmul")])
3640 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3641 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3642 (match_operand:SF 2 "gpc_reg_operand" "f"))
3643 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
3644 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3645 "fnmsubs %0,%1,%2,%3"
3646 [(set_attr "type" "fp")])
3649 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3650 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3651 (match_operand:SF 2 "gpc_reg_operand" "f"))
3652 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
3653 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3654 "{fnms|fnmsub} %0,%1,%2,%3"
3655 [(set_attr "type" "dmul")])
3657 (define_expand "sqrtsf2"
3658 [(set (match_operand:SF 0 "gpc_reg_operand" "")
3659 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
3660 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT"
3664 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3665 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
3666 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT"
3668 [(set_attr "type" "ssqrt")])
3671 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3672 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
3673 "TARGET_POWER2 && TARGET_HARD_FLOAT"
3675 [(set_attr "type" "dsqrt")])
3677 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
3678 ;; fsel instruction and some auxiliary computations. Then we just have a
3679 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
3681 (define_expand "maxsf3"
3683 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
3684 (match_operand:SF 2 "gpc_reg_operand" "")))
3685 (set (match_operand:SF 0 "gpc_reg_operand" "")
3686 (if_then_else:SF (ge (match_dup 3)
3690 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3692 { operands[3] = gen_reg_rtx (SFmode); }")
3695 [(set (match_operand:SF 0 "gpc_reg_operand" "")
3696 (smax:SF (match_operand:SF 1 "gpc_reg_operand" "")
3697 (match_operand:SF 2 "gpc_reg_operand" "")))
3698 (clobber (match_operand:SF 3 "gpc_reg_operand" ""))]
3699 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3701 (minus:SF (match_dup 1) (match_dup 2)))
3703 (if_then_else:SF (ge (match_dup 3)
3709 (define_expand "minsf3"
3711 (minus:SF (match_operand:SF 2 "gpc_reg_operand" "")
3712 (match_operand:SF 1 "gpc_reg_operand" "")))
3713 (set (match_operand:SF 0 "gpc_reg_operand" "")
3714 (if_then_else:SF (ge (match_dup 3)
3718 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3720 { operands[3] = gen_reg_rtx (SFmode); }")
3723 [(set (match_operand:SF 0 "gpc_reg_operand" "")
3724 (smin:SF (match_operand:SF 1 "gpc_reg_operand" "")
3725 (match_operand:SF 2 "gpc_reg_operand" "")))
3726 (clobber (match_operand:SF 3 "gpc_reg_operand" ""))]
3727 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3729 (minus:SF (match_dup 2) (match_dup 1)))
3731 (if_then_else:SF (ge (match_dup 3)
3737 (define_expand "movsfcc"
3738 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3739 (if_then_else:SF (match_operand 1 "comparison_operator" "")
3740 (match_operand:SF 2 "gpc_reg_operand" "f")
3741 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3742 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3746 enum rtx_code code = GET_CODE (operands[1]);
3747 if (! rs6000_compare_fp_p)
3751 case GE: case EQ: case NE:
3752 op0 = rs6000_compare_op0;
3753 op1 = rs6000_compare_op1;
3756 op0 = rs6000_compare_op1;
3757 op1 = rs6000_compare_op0;
3758 temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
3761 op0 = rs6000_compare_op1;
3762 op1 = rs6000_compare_op0;
3765 op0 = rs6000_compare_op0;
3766 op1 = rs6000_compare_op1;
3767 temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
3772 if (GET_MODE (rs6000_compare_op0) == DFmode)
3774 temp = gen_reg_rtx (DFmode);
3775 emit_insn (gen_subdf3 (temp, op0, op1));
3776 emit_insn (gen_fseldfsf4 (operands[0], temp, operands[2], operands[3]));
3779 emit_insn (gen_negdf2 (temp, temp));
3780 emit_insn (gen_fseldfsf4 (operands[0], temp, operands[0], operands[3]));
3782 else if (code == NE)
3784 emit_insn (gen_negdf2 (temp, temp));
3785 emit_insn (gen_fseldfsf4 (operands[0], temp, operands[3], operands[0]));
3790 temp = gen_reg_rtx (SFmode);
3791 emit_insn (gen_subsf3 (temp, op0, op1));
3792 emit_insn (gen_fselsfsf4 (operands[0], temp, operands[2], operands[3]));
3795 emit_insn (gen_negsf2 (temp, temp));
3796 emit_insn (gen_fselsfsf4 (operands[0], temp, operands[0], operands[3]));
3798 else if (code == NE)
3800 emit_insn (gen_negsf2 (temp, temp));
3801 emit_insn (gen_fselsfsf4 (operands[0], temp, operands[3], operands[0]));
3807 (define_insn "fselsfsf4"
3808 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3809 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
3811 (match_operand:SF 2 "gpc_reg_operand" "f")
3812 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3813 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3815 [(set_attr "type" "fp")])
3817 (define_insn "fseldfsf4"
3818 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3819 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
3821 (match_operand:SF 2 "gpc_reg_operand" "f")
3822 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3823 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3825 [(set_attr "type" "fp")])
3827 (define_insn "negdf2"
3828 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3829 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
3832 [(set_attr "type" "fp")])
3834 (define_insn "absdf2"
3835 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3836 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
3839 [(set_attr "type" "fp")])
3842 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3843 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
3846 [(set_attr "type" "fp")])
3848 (define_insn "adddf3"
3849 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3850 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3851 (match_operand:DF 2 "gpc_reg_operand" "f")))]
3853 "{fa|fadd} %0,%1,%2"
3854 [(set_attr "type" "fp")])
3856 (define_insn "subdf3"
3857 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3858 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
3859 (match_operand:DF 2 "gpc_reg_operand" "f")))]
3861 "{fs|fsub} %0,%1,%2"
3862 [(set_attr "type" "fp")])
3864 (define_insn "muldf3"
3865 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3866 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3867 (match_operand:DF 2 "gpc_reg_operand" "f")))]
3869 "{fm|fmul} %0,%1,%2"
3870 [(set_attr "type" "dmul")])
3872 (define_insn "divdf3"
3873 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3874 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
3875 (match_operand:DF 2 "gpc_reg_operand" "f")))]
3877 "{fd|fdiv} %0,%1,%2"
3878 [(set_attr "type" "ddiv")])
3881 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3882 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3883 (match_operand:DF 2 "gpc_reg_operand" "f"))
3884 (match_operand:DF 3 "gpc_reg_operand" "f")))]
3885 "TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3886 "{fma|fmadd} %0,%1,%2,%3"
3887 [(set_attr "type" "dmul")])
3890 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3891 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3892 (match_operand:DF 2 "gpc_reg_operand" "f"))
3893 (match_operand:DF 3 "gpc_reg_operand" "f")))]
3894 "TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3895 "{fms|fmsub} %0,%1,%2,%3"
3896 [(set_attr "type" "dmul")])
3899 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3900 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3901 (match_operand:DF 2 "gpc_reg_operand" "f"))
3902 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
3903 "TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3904 "{fnma|fnmadd} %0,%1,%2,%3"
3905 [(set_attr "type" "dmul")])
3908 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3909 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3910 (match_operand:DF 2 "gpc_reg_operand" "f"))
3911 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
3912 "TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3913 "{fnms|fnmsub} %0,%1,%2,%3"
3914 [(set_attr "type" "dmul")])
3916 (define_insn "sqrtdf2"
3917 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3918 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
3919 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT"
3921 [(set_attr "type" "dsqrt")])
3923 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
3924 ;; fsel instruction and some auxiliary computations. Then we just have a
3925 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
3928 (define_expand "maxdf3"
3930 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
3931 (match_operand:DF 2 "gpc_reg_operand" "")))
3932 (set (match_operand:DF 0 "gpc_reg_operand" "")
3933 (if_then_else:DF (ge (match_dup 3)
3937 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3939 { operands[3] = gen_reg_rtx (DFmode); }")
3942 [(set (match_operand:DF 0 "gpc_reg_operand" "")
3943 (smax:DF (match_operand:DF 1 "gpc_reg_operand" "")
3944 (match_operand:DF 2 "gpc_reg_operand" "")))
3945 (clobber (match_operand:DF 3 "gpc_reg_operand" ""))]
3946 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3948 (minus:DF (match_dup 1) (match_dup 2)))
3950 (if_then_else:DF (ge (match_dup 3)
3956 (define_expand "mindf3"
3958 (minus:DF (match_operand:DF 2 "gpc_reg_operand" "")
3959 (match_operand:DF 1 "gpc_reg_operand" "")))
3960 (set (match_operand:DF 0 "gpc_reg_operand" "")
3961 (if_then_else:DF (ge (match_dup 3)
3965 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3967 { operands[3] = gen_reg_rtx (DFmode); }")
3970 [(set (match_operand:DF 0 "gpc_reg_operand" "")
3971 (smin:DF (match_operand:DF 1 "gpc_reg_operand" "")
3972 (match_operand:DF 2 "gpc_reg_operand" "")))
3973 (clobber (match_operand:DF 3 "gpc_reg_operand" ""))]
3974 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3976 (minus:DF (match_dup 2) (match_dup 1)))
3978 (if_then_else:DF (ge (match_dup 3)
3984 (define_expand "movdfcc"
3985 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3986 (if_then_else:DF (match_operand 1 "comparison_operator" "")
3987 (match_operand:DF 2 "gpc_reg_operand" "f")
3988 (match_operand:DF 3 "gpc_reg_operand" "f")))]
3989 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3993 enum rtx_code code = GET_CODE (operands[1]);
3994 if (! rs6000_compare_fp_p)
3998 case GE: case EQ: case NE:
3999 op0 = rs6000_compare_op0;
4000 op1 = rs6000_compare_op1;
4003 op0 = rs6000_compare_op1;
4004 op1 = rs6000_compare_op0;
4005 temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
4008 op0 = rs6000_compare_op1;
4009 op1 = rs6000_compare_op0;
4012 op0 = rs6000_compare_op0;
4013 op1 = rs6000_compare_op1;
4014 temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
4019 if (GET_MODE (rs6000_compare_op0) == DFmode)
4021 temp = gen_reg_rtx (DFmode);
4022 emit_insn (gen_subdf3 (temp, op0, op1));
4023 emit_insn (gen_fseldfdf4 (operands[0], temp, operands[2], operands[3]));
4026 emit_insn (gen_negdf2 (temp, temp));
4027 emit_insn (gen_fseldfdf4 (operands[0], temp, operands[0], operands[3]));
4029 else if (code == NE)
4031 emit_insn (gen_negdf2 (temp, temp));
4032 emit_insn (gen_fseldfdf4 (operands[0], temp, operands[3], operands[0]));
4037 temp = gen_reg_rtx (SFmode);
4038 emit_insn (gen_subsf3 (temp, op0, op1));
4039 emit_insn (gen_fselsfdf4 (operands[0], temp, operands[2], operands[3]));
4042 emit_insn (gen_negsf2 (temp, temp));
4043 emit_insn (gen_fselsfdf4 (operands[0], temp, operands[0], operands[3]));
4045 else if (code == NE)
4047 emit_insn (gen_negsf2 (temp, temp));
4048 emit_insn (gen_fselsfdf4 (operands[0], temp, operands[3], operands[0]));
4054 (define_insn "fseldfdf4"
4055 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4056 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
4058 (match_operand:DF 2 "gpc_reg_operand" "f")
4059 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4060 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
4062 [(set_attr "type" "fp")])
4064 (define_insn "fselsfdf4"
4065 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4066 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
4068 (match_operand:DF 2 "gpc_reg_operand" "f")
4069 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4072 [(set_attr "type" "fp")])
4074 ;; Conversions to and from floating-point.
4076 (define_expand "floatsidf2"
4077 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
4078 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
4081 (clobber (match_dup 4))
4082 (clobber (match_dup 5))
4083 (clobber (reg:DF 76))])]
4087 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
4088 operands[3] = force_reg (DFmode, rs6000_float_const (\"4503601774854144\", DFmode));
4089 operands[4] = gen_reg_rtx (SImode);
4090 operands[5] = gen_reg_rtx (Pmode);
4093 (define_insn "*floatsidf2_internal"
4094 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
4095 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
4096 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
4097 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
4098 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
4099 (clobber (match_operand 5 "gpc_reg_operand" "=b"))
4100 (clobber (reg:DF 76))]
4103 [(set_attr "length" "24")])
4106 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4107 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
4108 (use (match_operand:SI 2 "gpc_reg_operand" ""))
4109 (use (match_operand:DF 3 "gpc_reg_operand" ""))
4110 (clobber (match_operand:SI 4 "gpc_reg_operand" ""))
4111 (clobber (match_operand 5 "gpc_reg_operand" ""))
4112 (clobber (reg:DF 76))]
4115 (xor:SI (match_dup 1)
4118 (unspec [(const_int 0)] 11))
4120 (unspec [(match_dup 4)
4121 (match_dup 5)] 12)) ;; low word
4123 (unspec [(match_dup 2)
4125 (match_dup 7)] 13)) ;; high word
4127 (unspec [(match_dup 7)
4130 (minus:DF (match_dup 0)
4134 operands[6] = GEN_INT (0x80000000);
4135 operands[7] = gen_rtx_REG (DFmode, FPMEM_REGNUM);
4138 (define_expand "floatunssidf2"
4139 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
4140 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
4143 (clobber (match_dup 4))
4144 (clobber (reg:DF 76))])]
4148 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
4149 operands[3] = force_reg (DFmode, rs6000_float_const (\"4503599627370496\", DFmode));
4150 operands[4] = gen_reg_rtx (Pmode);
4153 (define_insn "*floatunssidf2_internal"
4154 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
4155 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
4156 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
4157 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
4158 (clobber (match_operand 4 "gpc_reg_operand" "=b"))
4159 (clobber (reg:DF 76))]
4162 [(set_attr "length" "20")])
4165 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4166 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
4167 (use (match_operand:SI 2 "gpc_reg_operand" ""))
4168 (use (match_operand:DF 3 "gpc_reg_operand" ""))
4169 (clobber (match_operand 4 "gpc_reg_operand" ""))
4170 (clobber (reg:DF 76))]
4173 (unspec [(const_int 0)] 11))
4175 (unspec [(match_dup 1)
4176 (match_dup 4)] 12)) ;; low word
4178 (unspec [(match_dup 2)
4180 (match_dup 5)] 13)) ;; high word
4182 (unspec [(match_dup 5)
4185 (minus:DF (match_dup 0)
4187 "operands[5] = gen_rtx_REG (DFmode, FPMEM_REGNUM);")
4189 ;; Load up scratch register with base address + offset if needed
4190 (define_insn "*floatsidf2_loadaddr"
4191 [(set (match_operand 0 "gpc_reg_operand" "=b")
4192 (unspec [(const_int 0)] 11))]
4196 if (rs6000_fpmem_offset > 32760)
4200 xop[0] = operands[0];
4201 xop[1] = (frame_pointer_needed) ? frame_pointer_rtx : stack_pointer_rtx;
4202 xop[2] = GEN_INT ((rs6000_fpmem_offset >> 16) + ((rs6000_fpmem_offset & 0x8000) >> 15));
4203 output_asm_insn (\"{cau|addis} %0,%1,%2\", xop);
4208 [(set_attr "length" "4")])
4210 (define_insn "*floatsidf2_store1"
4212 (unspec [(match_operand:SI 0 "gpc_reg_operand" "r")
4213 (match_operand 1 "gpc_reg_operand" "b")] 12))]
4219 if (rs6000_fpmem_offset > 32760)
4221 else if (frame_pointer_needed)
4222 indx = frame_pointer_rtx;
4224 indx = stack_pointer_rtx;
4226 operands[2] = gen_rtx_MEM (SImode,
4227 gen_rtx_PLUS (Pmode,
4229 GEN_INT ((((rs6000_fpmem_offset & 0xffff) ^ 0x8000) - 0x8000)
4230 + ((WORDS_BIG_ENDIAN != 0) * 4))));
4232 return \"{st|stw} %0,%2\";
4234 [(set_attr "type" "store")])
4236 (define_insn "*floatsidf2_store2"
4238 (unspec [(match_operand:SI 0 "gpc_reg_operand" "r")
4239 (match_operand 1 "gpc_reg_operand" "b")
4246 if (rs6000_fpmem_offset > 32760)
4248 else if (frame_pointer_needed)
4249 indx = frame_pointer_rtx;
4251 indx = stack_pointer_rtx;
4253 operands[2] = gen_rtx_MEM (SImode,
4254 gen_rtx_PLUS (Pmode,
4256 GEN_INT ((((rs6000_fpmem_offset & 0xffff) ^ 0x8000) - 0x8000)
4257 + ((WORDS_BIG_ENDIAN == 0) * 4))));
4259 return \"{st|stw} %0,%2\";
4261 [(set_attr "type" "store")])
4263 (define_insn "*floatsidf2_load"
4264 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4265 (unspec [(reg:DF 76)
4266 (match_operand 1 "gpc_reg_operand" "b")] 14))]
4271 HOST_WIDE_INT offset = rs6000_fpmem_offset;
4273 if (rs6000_fpmem_offset > 32760)
4276 offset = (((offset & 0xffff) ^ 0x8000) - 0x8000);
4278 else if (frame_pointer_needed)
4279 indx = frame_pointer_rtx;
4281 indx = stack_pointer_rtx;
4283 operands[2] = gen_rtx_MEM (SImode,
4284 gen_rtx_PLUS (Pmode, indx, GEN_INT (offset)));
4286 return \"lfd %0,%2\";
4288 [(set_attr "type" "fpload")])
4290 (define_expand "fix_truncdfsi2"
4291 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
4292 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
4293 (clobber (match_dup 2))
4294 (clobber (match_dup 3))
4295 (clobber (match_dup 4))])]
4299 if (!TARGET_POWER2 && !TARGET_POWERPC)
4301 emit_insn (gen_trunc_call (operands[0], operands[1],
4302 gen_rtx_SYMBOL_REF (Pmode, RS6000_ITRUNC)));
4306 operands[2] = gen_reg_rtx (DImode);
4307 operands[3] = gen_reg_rtx (Pmode);
4308 operands[4] = gen_rtx_REG (DImode, FPMEM_REGNUM);
4311 (define_insn "*fix_truncdfsi2_internal"
4312 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4313 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
4314 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
4315 (clobber (match_operand 3 "gpc_reg_operand" "=b"))
4316 (clobber (reg:DI 76))]
4319 [(set_attr "length" "12")])
4322 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4323 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
4324 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
4325 (clobber (match_operand 3 "gpc_reg_operand" ""))
4326 (clobber (reg:DI 76))]
4329 (sign_extend:DI (fix:SI (match_operand:DF 1 "gpc_reg_operand" ""))))
4331 (unspec [(const_int 0)] 11))
4333 (unspec [(match_dup 2)
4335 (set (match_operand:SI 0 "gpc_reg_operand" "")
4336 (unspec [(match_dup 4)
4337 (match_dup 3)] 16))]
4338 "operands[4] = gen_rtx_REG (DImode, FPMEM_REGNUM);")
4340 (define_insn "*fix_truncdfsi2_store"
4342 (unspec [(match_operand:DI 0 "gpc_reg_operand" "f")
4343 (match_operand 1 "gpc_reg_operand" "b")] 15))]
4344 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT"
4349 if (rs6000_fpmem_offset > 32760)
4351 else if (frame_pointer_needed)
4352 indx = frame_pointer_rtx;
4354 indx = stack_pointer_rtx;
4356 operands[2] = gen_rtx_MEM (DFmode,
4357 gen_rtx_PLUS (Pmode,
4359 GEN_INT ((((rs6000_fpmem_offset & 0xffff)
4360 ^ 0x8000) - 0x8000))));
4362 return \"stfd %0,%2\";
4364 [(set_attr "type" "fpstore")])
4366 (define_insn "*fix_truncdfsi2_load"
4367 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4368 (unspec [(reg:DI 76)
4369 (match_operand 1 "gpc_reg_operand" "b")] 16))]
4370 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT"
4375 if (rs6000_fpmem_offset > 32760)
4377 else if (frame_pointer_needed)
4378 indx = frame_pointer_rtx;
4380 indx = stack_pointer_rtx;
4382 operands[2] = gen_rtx_MEM (DFmode,
4383 gen_rtx_PLUS (Pmode,
4385 GEN_INT ((((rs6000_fpmem_offset & 0xffff) ^ 0x8000) - 0x8000)
4386 + ((WORDS_BIG_ENDIAN) ? 4 : 0))));
4388 return \"{l|lwz} %0,%2\";
4390 [(set_attr "type" "load")])
4392 (define_expand "fixuns_truncdfsi2"
4393 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4394 (unsigned_fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))]
4395 "! TARGET_POWER2 && ! TARGET_POWERPC && TARGET_HARD_FLOAT"
4398 emit_insn (gen_trunc_call (operands[0], operands[1],
4399 gen_rtx_SYMBOL_REF (Pmode, RS6000_UITRUNC)));
4403 (define_expand "trunc_call"
4404 [(parallel [(set (match_operand:SI 0 "" "")
4405 (fix:SI (match_operand:DF 1 "" "")))
4406 (use (match_operand:SI 2 "" ""))])]
4410 rtx insns = gen_trunc_call_rtl (operands[0], operands[1], operands[2]);
4411 rtx first = XVECEXP (insns, 0, 0);
4412 rtx last = XVECEXP (insns, 0, XVECLEN (insns, 0) - 1);
4414 REG_NOTES (first) = gen_rtx_INSN_LIST (REG_LIBCALL, last,
4416 REG_NOTES (last) = gen_rtx_INSN_LIST (REG_RETVAL, first, REG_NOTES (last));
4422 (define_expand "trunc_call_rtl"
4423 [(set (reg:DF 33) (match_operand:DF 1 "gpc_reg_operand" ""))
4425 (parallel [(set (reg:SI 3)
4426 (call (mem:SI (match_operand 2 "" "")) (const_int 0)))
4428 (clobber (scratch:SI))])
4429 (set (match_operand:SI 0 "gpc_reg_operand" "")
4434 rs6000_trunc_used = 1;
4437 (define_insn "*fctiwz"
4438 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
4439 (sign_extend:DI (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))))]
4440 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT"
4441 "{fcirz|fctiwz} %0,%1"
4442 [(set_attr "type" "fp")])
4444 (define_insn "floatdidf2"
4445 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4446 (float:DF (match_operand:DI 1 "gpc_reg_operand" "f")))]
4447 "TARGET_POWERPC64 && TARGET_HARD_FLOAT"
4449 [(set_attr "type" "fp")])
4451 (define_insn "fix_truncdfdi2"
4452 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
4453 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
4454 "TARGET_POWERPC64 && TARGET_HARD_FLOAT"
4456 [(set_attr "type" "fp")])
4458 ;; Define the DImode operations that can be done in a small number
4459 ;; of instructions. The & constraints are to prevent the register
4460 ;; allocator from allocating registers that overlap with the inputs
4461 ;; (for example, having an input in 7,8 and an output in 6,7). We
4462 ;; also allow for the output being the same as one of the inputs.
4464 (define_insn "*adddi3_noppc64"
4465 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
4466 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
4467 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
4468 "! TARGET_POWERPC64"
4471 if (WORDS_BIG_ENDIAN)
4472 return (GET_CODE (operands[2])) != CONST_INT
4473 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
4474 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
4476 return (GET_CODE (operands[2])) != CONST_INT
4477 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
4478 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
4480 [(set_attr "length" "8")])
4482 (define_insn "*subdi3_noppc64"
4483 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
4484 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
4485 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
4486 "! TARGET_POWERPC64"
4489 if (WORDS_BIG_ENDIAN)
4490 return (GET_CODE (operands[1]) != CONST_INT)
4491 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
4492 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
4494 return (GET_CODE (operands[1]) != CONST_INT)
4495 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
4496 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
4498 [(set_attr "length" "8")])
4500 (define_insn "*negdi2_noppc64"
4501 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
4502 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
4503 "! TARGET_POWERPC64"
4506 return (WORDS_BIG_ENDIAN)
4507 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
4508 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
4510 [(set_attr "length" "8")])
4512 (define_expand "mulsidi3"
4513 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4514 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
4515 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
4516 "! TARGET_POWERPC64"
4519 if (! TARGET_POWER && ! TARGET_POWERPC)
4521 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
4522 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
4523 emit_insn (gen_mull_call ());
4524 if (WORDS_BIG_ENDIAN)
4525 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
4528 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
4529 gen_rtx_REG (SImode, 3));
4530 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
4531 gen_rtx_REG (SImode, 4));
4535 else if (TARGET_POWER)
4537 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
4542 (define_insn "mulsidi3_mq"
4543 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4544 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
4545 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
4546 (clobber (match_scratch:SI 3 "=q"))]
4548 "mul %0,%1,%2\;mfmq %L0"
4549 [(set_attr "type" "imul")
4550 (set_attr "length" "8")])
4552 (define_insn "*mulsidi3_no_mq"
4553 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
4554 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
4555 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
4556 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
4559 return (WORDS_BIG_ENDIAN)
4560 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
4561 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
4563 [(set_attr "type" "imul")
4564 (set_attr "length" "8")])
4567 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4568 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
4569 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
4570 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
4573 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
4574 (sign_extend:DI (match_dup 2)))
4577 (mult:SI (match_dup 1)
4581 int endian = (WORDS_BIG_ENDIAN == 0);
4582 operands[3] = operand_subword (operands[0], endian, 0, DImode);
4583 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
4586 (define_expand "umulsidi3"
4587 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4588 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
4589 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
4590 "TARGET_POWERPC && ! TARGET_POWERPC64"
4595 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
4600 (define_insn "umulsidi3_mq"
4601 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
4602 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
4603 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
4604 (clobber (match_scratch:SI 3 "=q"))]
4605 "TARGET_POWERPC && TARGET_POWER"
4608 return (WORDS_BIG_ENDIAN)
4609 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
4610 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
4612 [(set_attr "type" "imul")
4613 (set_attr "length" "8")])
4615 (define_insn "*umulsidi3_no_mq"
4616 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
4617 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
4618 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
4619 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
4622 return (WORDS_BIG_ENDIAN)
4623 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
4624 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
4626 [(set_attr "type" "imul")
4627 (set_attr "length" "8")])
4630 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4631 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
4632 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
4633 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
4636 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
4637 (zero_extend:DI (match_dup 2)))
4640 (mult:SI (match_dup 1)
4644 int endian = (WORDS_BIG_ENDIAN == 0);
4645 operands[3] = operand_subword (operands[0], endian, 0, DImode);
4646 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
4649 (define_expand "smulsi3_highpart"
4650 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4652 (lshiftrt:DI (mult:DI (sign_extend:DI
4653 (match_operand:SI 1 "gpc_reg_operand" "%r"))
4655 (match_operand:SI 2 "gpc_reg_operand" "r")))
4660 if (! TARGET_POWER && ! TARGET_POWERPC)
4662 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
4663 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
4664 emit_insn (gen_mulh_call ());
4665 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
4668 else if (TARGET_POWER)
4670 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
4675 (define_insn "smulsi3_highpart_mq"
4676 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4678 (lshiftrt:DI (mult:DI (sign_extend:DI
4679 (match_operand:SI 1 "gpc_reg_operand" "%r"))
4681 (match_operand:SI 2 "gpc_reg_operand" "r")))
4683 (clobber (match_scratch:SI 3 "=q"))]
4686 [(set_attr "type" "imul")])
4688 (define_insn "*smulsi3_highpart_no_mq"
4689 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4691 (lshiftrt:DI (mult:DI (sign_extend:DI
4692 (match_operand:SI 1 "gpc_reg_operand" "%r"))
4694 (match_operand:SI 2 "gpc_reg_operand" "r")))
4696 "TARGET_POWERPC && ! TARGET_POWER"
4698 [(set_attr "type" "imul")])
4700 (define_expand "umulsi3_highpart"
4701 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4703 (lshiftrt:DI (mult:DI (zero_extend:DI
4704 (match_operand:SI 1 "gpc_reg_operand" ""))
4706 (match_operand:SI 2 "gpc_reg_operand" "")))
4713 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
4718 (define_insn "umulsi3_highpart_mq"
4719 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4721 (lshiftrt:DI (mult:DI (zero_extend:DI
4722 (match_operand:SI 1 "gpc_reg_operand" "%r"))
4724 (match_operand:SI 2 "gpc_reg_operand" "r")))
4726 (clobber (match_scratch:SI 3 "=q"))]
4727 "TARGET_POWERPC && TARGET_POWER"
4729 [(set_attr "type" "imul")])
4731 (define_insn "*umulsi3_highpart_no_mq"
4732 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4734 (lshiftrt:DI (mult:DI (zero_extend:DI
4735 (match_operand:SI 1 "gpc_reg_operand" "%r"))
4737 (match_operand:SI 2 "gpc_reg_operand" "r")))
4739 "TARGET_POWERPC && ! TARGET_POWER"
4741 [(set_attr "type" "imul")])
4743 ;; If operands 0 and 2 are in the same register, we have a problem. But
4744 ;; operands 0 and 1 (the usual case) can be in the same register. That's
4745 ;; why we have the strange constraints below.
4746 (define_insn "ashldi3_power"
4747 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
4748 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
4749 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
4750 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
4753 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
4754 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
4755 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
4756 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
4757 [(set_attr "length" "8")])
4759 (define_insn "lshrdi3_power"
4760 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
4761 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
4762 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
4763 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
4766 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
4767 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
4768 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
4769 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
4770 [(set_attr "length" "8")])
4772 ;; Shift by a variable amount is too complex to be worth open-coding. We
4773 ;; just handle shifts by constants.
4774 (define_insn "ashrdi3_power"
4775 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
4776 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
4777 (match_operand:SI 2 "const_int_operand" "M,i")))
4778 (clobber (match_scratch:SI 3 "=X,q"))]
4781 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
4782 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
4783 [(set_attr "length" "8")])
4785 ;; PowerPC64 DImode operations.
4787 (define_expand "adddi3"
4788 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4789 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
4790 (match_operand:DI 2 "reg_or_cint_operand" "")))]
4794 if (! TARGET_POWERPC64)
4796 if (non_short_cint_operand (operands[2], DImode))
4800 if (GET_CODE (operands[2]) == CONST_INT
4801 && !add_operand (operands[2], DImode))
4803 rtx tmp = ((reload_in_progress || reload_completed
4804 || rtx_equal_p (operands[0], operands[1]))
4805 ? operands[0] : gen_reg_rtx (DImode));
4807 HOST_WIDE_INT low = INTVAL (operands[2]) & 0xffff;
4808 HOST_WIDE_INT high = INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff);
4811 high += 0x10000, low |= ((HOST_WIDE_INT) -1) << 16;
4813 emit_insn (gen_adddi3 (tmp, operands[1], GEN_INT (high)));
4814 emit_insn (gen_adddi3 (operands[0], tmp, GEN_INT (low)));
4819 ;; Discourage ai/addic because of carry but provide it in an alternative
4820 ;; allowing register zero as source.
4822 (define_insn "*adddi3_internal1"
4823 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,?r,r")
4824 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,b,r,b")
4825 (match_operand:DI 2 "add_operand" "r,I,I,J")))]
4833 (define_insn "*adddi3_internal2"
4834 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
4835 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
4836 (match_operand:DI 2 "reg_or_short_operand" "r,I"))
4838 (clobber (match_scratch:DI 3 "=r,r"))]
4843 [(set_attr "type" "compare")])
4845 (define_insn "*adddi3_internal3"
4846 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
4847 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
4848 (match_operand:DI 2 "reg_or_short_operand" "r,I"))
4850 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4851 (plus:DI (match_dup 1) (match_dup 2)))]
4856 [(set_attr "type" "compare")])
4858 ;; Split an add that we can't do in one insn into two insns, each of which
4859 ;; does one 16-bit part. This is used by combine. Note that the low-order
4860 ;; add should be last in case the result gets used in an address.
4863 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4864 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
4865 (match_operand:DI 2 "non_add_cint_operand" "")))]
4867 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
4868 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
4871 HOST_WIDE_INT low = INTVAL (operands[2]) & 0xffff;
4872 HOST_WIDE_INT high = INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff);
4875 high+=0x10000, low |= ((HOST_WIDE_INT) -1) << 16;
4877 operands[3] = GEN_INT (high);
4878 operands[4] = GEN_INT (low);
4881 (define_insn "one_cmpldi2"
4882 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4883 (not:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
4888 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4889 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4891 (clobber (match_scratch:DI 2 "=r"))]
4894 [(set_attr "type" "compare")])
4897 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
4898 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4900 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4901 (not:DI (match_dup 1)))]
4904 [(set_attr "type" "compare")])
4907 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4908 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I")
4909 (match_operand:DI 2 "gpc_reg_operand" "r,r")))]
4916 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4917 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4918 (match_operand:DI 2 "gpc_reg_operand" "r"))
4920 (clobber (match_scratch:DI 3 "=r"))]
4923 [(set_attr "type" "compare")])
4926 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4927 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4928 (match_operand:DI 2 "gpc_reg_operand" "r"))
4930 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4931 (minus:DI (match_dup 1) (match_dup 2)))]
4934 [(set_attr "type" "compare")])
4936 (define_expand "subdi3"
4937 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4938 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "")
4939 (match_operand:DI 2 "reg_or_cint_operand" "")))]
4943 if (GET_CODE (operands[2]) == CONST_INT)
4945 emit_insn (gen_adddi3 (operands[0], operands[1],
4946 negate_rtx (DImode, operands[2])));
4951 (define_insn "absdi2"
4952 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
4953 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
4954 (clobber (match_scratch:DI 2 "=&r,&r"))]
4956 "sradi %2,%1,63\;xor %0,%2,%1\;subf %0,%2,%0"
4957 [(set_attr "length" "12")])
4960 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
4961 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
4962 (clobber (match_scratch:DI 2 "=&r,&r"))]
4963 "TARGET_POWERPC64 && reload_completed"
4964 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
4965 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
4966 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
4970 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
4971 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
4972 (clobber (match_scratch:DI 2 "=&r,&r"))]
4974 "sradi %2,%1,63\;xor %0,%2,%1\;subf %0,%0,%2"
4975 [(set_attr "length" "12")])
4978 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
4979 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
4980 (clobber (match_scratch:DI 2 "=&r,&r"))]
4981 "TARGET_POWERPC64 && reload_completed"
4982 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
4983 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
4984 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
4987 (define_expand "negdi2"
4988 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4989 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
4994 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4995 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
5000 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
5001 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
5003 (clobber (match_scratch:DI 2 "=r"))]
5006 [(set_attr "type" "compare")])
5009 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
5010 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
5012 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
5013 (neg:DI (match_dup 1)))]
5016 [(set_attr "type" "compare")])
5018 (define_insn "ffsdi2"
5019 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5020 (ffs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
5022 "neg %0,%1\;and %0,%0,%1\;cntlzd %0,%0\;subfic %0,%0,64"
5023 [(set_attr "length" "16")])
5025 (define_insn "muldi3"
5026 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5027 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
5028 (match_operand:DI 2 "gpc_reg_operand" "r")))]
5031 [(set_attr "type" "imul")])
5033 (define_insn "smuldi3_highpart"
5034 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5036 (lshiftrt:TI (mult:TI (sign_extend:TI
5037 (match_operand:DI 1 "gpc_reg_operand" "%r"))
5039 (match_operand:DI 2 "gpc_reg_operand" "r")))
5043 [(set_attr "type" "imul")])
5045 (define_insn "umuldi3_highpart"
5046 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5048 (lshiftrt:TI (mult:TI (zero_extend:TI
5049 (match_operand:DI 1 "gpc_reg_operand" "%r"))
5051 (match_operand:DI 2 "gpc_reg_operand" "r")))
5055 [(set_attr "type" "imul")])
5057 (define_expand "divdi3"
5058 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5059 (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
5060 (match_operand:DI 2 "reg_or_cint_operand" "")))]
5064 if (GET_CODE (operands[2]) == CONST_INT
5065 && exact_log2 (INTVAL (operands[2])) >= 0)
5068 operands[2] = force_reg (DImode, operands[2]);
5071 (define_expand "moddi3"
5072 [(use (match_operand:DI 0 "gpc_reg_operand" ""))
5073 (use (match_operand:DI 1 "gpc_reg_operand" ""))
5074 (use (match_operand:DI 2 "reg_or_cint_operand" ""))]
5078 int i = exact_log2 (INTVAL (operands[2]));
5082 if (GET_CODE (operands[2]) != CONST_INT || i < 0)
5085 temp1 = gen_reg_rtx (DImode);
5086 temp2 = gen_reg_rtx (DImode);
5088 emit_insn (gen_divdi3 (temp1, operands[1], operands[2]));
5089 emit_insn (gen_ashldi3 (temp2, temp1, GEN_INT (i)));
5090 emit_insn (gen_subdi3 (operands[0], operands[1], temp2));
5095 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5096 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5097 (match_operand:DI 2 "const_int_operand" "N")))]
5098 "TARGET_POWERPC64 && exact_log2 (INTVAL (operands[2])) >= 0"
5099 "sradi %0,%1,%p2\;addze %0,%0"
5100 [(set_attr "length" "8")])
5103 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
5104 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5105 (match_operand:DI 2 "const_int_operand" "N"))
5107 (clobber (match_scratch:DI 3 "=r"))]
5108 "TARGET_POWERPC64 && exact_log2 (INTVAL (operands[2])) >= 0"
5109 "sradi %3,%1,%p2\;addze. %3,%3"
5110 [(set_attr "type" "compare")
5111 (set_attr "length" "8")])
5114 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
5115 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5116 (match_operand:DI 2 "const_int_operand" "N"))
5118 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
5119 (div:DI (match_dup 1) (match_dup 2)))]
5120 "TARGET_POWERPC64 && exact_log2 (INTVAL (operands[2])) >= 0"
5121 "sradi %0,%1,%p2\;addze. %0,%0"
5122 [(set_attr "type" "compare")
5123 (set_attr "length" "8")])
5126 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5127 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5128 (match_operand:DI 2 "gpc_reg_operand" "r")))]
5131 [(set_attr "type" "idiv")])
5133 (define_insn "udivdi3"
5134 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5135 (udiv:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5136 (match_operand:DI 2 "gpc_reg_operand" "r")))]
5139 [(set_attr "type" "idiv")])
5141 (define_insn "rotldi3"
5142 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5143 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5144 (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
5146 "rld%I2cl %0,%1,%H2,0")
5148 (define_insn "*rotldi3_internal2"
5149 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
5150 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5151 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
5153 (clobber (match_scratch:DI 3 "=r"))]
5155 "rld%I2cl. %3,%1,%H2,0"
5156 [(set_attr "type" "delayed_compare")])
5158 (define_insn "*rotldi3_internal3"
5159 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
5160 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5161 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
5163 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
5164 (rotate:DI (match_dup 1) (match_dup 2)))]
5166 "rld%I2cl. %0,%1,%H2,0"
5167 [(set_attr "type" "delayed_compare")])
5169 (define_insn "*rotldi3_internal4"
5170 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5171 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5172 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
5173 (match_operand:DI 3 "mask64_operand" "S")))]
5175 "rld%I2c%B3 %0,%1,%H2,%S3")
5177 (define_insn "*rotldi3_internal5"
5178 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
5180 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5181 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
5182 (match_operand:DI 3 "mask64_operand" "S"))
5184 (clobber (match_scratch:DI 4 "=r"))]
5186 "rld%I2c%B3. %4,%1,%H2,%S3"
5187 [(set_attr "type" "delayed_compare")])
5189 (define_insn "*rotldi3_internal6"
5190 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
5192 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5193 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
5194 (match_operand:DI 3 "mask64_operand" "S"))
5196 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
5197 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
5199 "rld%I2c%B3. %0,%1,%H2,%S3"
5200 [(set_attr "type" "delayed_compare")])
5202 (define_insn "*rotldi3_internal7"
5203 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5206 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5207 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
5209 "rld%I2cl %0,%1,%H2,56")
5211 (define_insn "*rotldi3_internal8"
5212 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
5213 (compare:CC (zero_extend:DI
5215 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5216 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0))
5218 (clobber (match_scratch:DI 3 "=r"))]
5220 "rld%I2cl. %3,%1,%H2,56"
5221 [(set_attr "type" "delayed_compare")])
5223 (define_insn "*rotldi3_internal9"
5224 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
5225 (compare:CC (zero_extend:DI
5227 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5228 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0))
5230 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
5231 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
5233 "rld%I2cl. %0,%1,%H2,56"
5234 [(set_attr "type" "delayed_compare")])
5236 (define_insn "*rotldi3_internal10"
5237 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5240 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5241 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
5243 "rld%I2cl %0,%1,%H2,48")
5245 (define_insn "*rotldi3_internal11"
5246 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
5247 (compare:CC (zero_extend:DI
5249 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5250 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0))
5252 (clobber (match_scratch:DI 3 "=r"))]
5254 "rld%I2cl. %3,%1,%H2,48"
5255 [(set_attr "type" "delayed_compare")])
5257 (define_insn "*rotldi3_internal12"
5258 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
5259 (compare:CC (zero_extend:DI
5261 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5262 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0))
5264 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
5265 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
5267 "rld%I2cl. %0,%1,%H2,48"
5268 [(set_attr "type" "delayed_compare")])
5270 (define_insn "*rotldi3_internal13"
5271 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5274 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5275 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
5277 "rld%I2cl %0,%1,%H2,32")
5279 (define_insn "*rotldi3_internal14"
5280 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
5281 (compare:CC (zero_extend:DI
5283 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5284 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0))
5286 (clobber (match_scratch:DI 3 "=r"))]
5288 "rld%I2cl. %3,%1,%H2,32"
5289 [(set_attr "type" "delayed_compare")])
5291 (define_insn "*rotldi3_internal15"
5292 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
5293 (compare:CC (zero_extend:DI
5295 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5296 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0))
5298 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
5299 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
5301 "rld%I2cl. %0,%1,%H2,32"
5302 [(set_attr "type" "delayed_compare")])
5304 (define_expand "ashldi3"
5305 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5306 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
5307 (match_operand:SI 2 "reg_or_cint_operand" "")))]
5308 "TARGET_POWERPC64 || TARGET_POWER"
5311 if (TARGET_POWERPC64)
5313 else if (TARGET_POWER)
5315 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
5323 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5324 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5325 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
5328 [(set_attr "length" "8")])
5331 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
5332 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5333 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
5335 (clobber (match_scratch:DI 3 "=r"))]
5338 [(set_attr "type" "delayed_compare")])
5341 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
5342 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5343 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
5345 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
5346 (ashift:DI (match_dup 1) (match_dup 2)))]
5349 [(set_attr "type" "delayed_compare")])
5351 (define_expand "lshrdi3"
5352 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5353 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
5354 (match_operand:SI 2 "reg_or_cint_operand" "")))]
5355 "TARGET_POWERPC64 || TARGET_POWER"
5358 if (TARGET_POWERPC64)
5360 else if (TARGET_POWER)
5362 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
5370 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5371 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5372 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
5377 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
5378 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5379 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
5381 (clobber (match_scratch:DI 3 "=r"))]
5384 [(set_attr "type" "delayed_compare")])
5387 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
5388 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5389 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
5391 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
5392 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
5395 [(set_attr "type" "delayed_compare")])
5397 (define_expand "ashrdi3"
5398 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5399 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
5400 (match_operand:SI 2 "reg_or_cint_operand" "")))]
5401 "TARGET_POWERPC64 || TARGET_POWER"
5404 if (TARGET_POWERPC64)
5406 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
5408 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
5416 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5417 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5418 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
5420 "srad%I2 %0,%1,%H2")
5423 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
5424 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5425 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
5427 (clobber (match_scratch:DI 3 "=r"))]
5429 "srad%I2. %3,%1,%H2"
5430 [(set_attr "type" "delayed_compare")])
5433 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
5434 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5435 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
5437 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
5438 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
5440 "srad%I2. %0,%1,%H2"
5441 [(set_attr "type" "delayed_compare")])
5443 (define_insn "anddi3"
5444 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
5445 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
5446 (match_operand:DI 2 "and64_operand" "?r,S,K,J")))
5447 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
5451 rldic%B2 %0,%1,0,%S2
5455 (define_insn "*anddi3_internal2"
5456 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x")
5457 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
5458 (match_operand:DI 2 "and64_operand" "r,K,J,S"))
5460 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
5466 rldic%B2. %3,%1,0,%S2"
5467 [(set_attr "type" "compare,compare,compare,delayed_compare")])
5469 (define_insn "*anddi3_internal3"
5470 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x")
5471 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
5472 (match_operand:DI 2 "and64_operand" "r,K,J,S"))
5474 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
5475 (and:DI (match_dup 1) (match_dup 2)))]
5481 rldic%B2. %3,%1,0,%S2"
5482 [(set_attr "type" "compare,compare,compare,delayed_compare")])
5484 (define_expand "iordi3"
5485 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5486 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
5487 (match_operand:DI 2 "reg_or_cint_operand" "")))]
5491 if (GET_CODE (operands[2]) == CONST_INT
5492 && !logical_operand (operands[2], DImode))
5494 HOST_WIDE_INT value = INTVAL (operands[2]);
5495 rtx tmp = ((reload_in_progress || reload_completed
5496 || rtx_equal_p (operands[0], operands[1]))
5497 ? operands[0] : gen_reg_rtx (DImode));
5499 emit_insn (gen_iordi3 (tmp, operands[1],
5500 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
5501 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
5506 (define_insn "*iordi3_internal1"
5507 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
5508 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
5509 (match_operand:DI 2 "logical_operand" "r,K,J")))]
5516 (define_insn "*iordi3_internal2"
5517 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
5518 (compare:CC (ior:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
5519 (match_operand:DI 2 "gpc_reg_operand" "r"))
5521 (clobber (match_scratch:DI 3 "=r"))]
5524 [(set_attr "type" "compare")])
5526 (define_insn "*iordi3_internal3"
5527 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
5528 (compare:CC (ior:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
5529 (match_operand:DI 2 "gpc_reg_operand" "r"))
5531 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
5532 (ior:DI (match_dup 1) (match_dup 2)))]
5535 [(set_attr "type" "compare")])
5537 ;; Split an IOR that we can't do in one insn into two insns, each of which
5538 ;; does one 16-bit part. This is used by combine.
5541 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5542 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
5543 (match_operand:DI 2 "non_logical_cint_operand" "")))]
5545 [(set (match_dup 0) (ior:DI (match_dup 1) (match_dup 3)))
5546 (set (match_dup 0) (ior:DI (match_dup 0) (match_dup 4)))]
5549 operands[3] = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
5550 operands[4] = GEN_INT (INTVAL (operands[2]) & 0xffff);
5553 (define_expand "xordi3"
5554 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5555 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
5556 (match_operand:DI 2 "reg_or_cint_operand" "")))]
5560 if (GET_CODE (operands[2]) == CONST_INT
5561 && !logical_operand (operands[2], DImode))
5563 HOST_WIDE_INT value = INTVAL (operands[2]);
5564 rtx tmp = ((reload_in_progress || reload_completed
5565 || rtx_equal_p (operands[0], operands[1]))
5566 ? operands[0] : gen_reg_rtx (DImode));
5568 emit_insn (gen_xordi3 (tmp, operands[1],
5569 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
5570 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
5575 (define_insn "*xordi3_internal1"
5576 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
5577 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
5578 (match_operand:DI 2 "logical_operand" "r,K,J")))]
5585 (define_insn "*xordi3_internal2"
5586 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
5587 (compare:CC (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
5588 (match_operand:DI 2 "gpc_reg_operand" "r"))
5590 (clobber (match_scratch:DI 3 "=r"))]
5593 [(set_attr "type" "compare")])
5595 (define_insn "*xordi3_internal3"
5596 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
5597 (compare:CC (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
5598 (match_operand:DI 2 "gpc_reg_operand" "r"))
5600 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
5601 (xor:DI (match_dup 1) (match_dup 2)))]
5604 [(set_attr "type" "compare")])
5606 ;; Split an XOR that we can't do in one insn into two insns, each of which
5607 ;; does one 16-bit part. This is used by combine.
5610 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5611 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
5612 (match_operand:DI 2 "non_logical_cint_operand" "")))]
5614 [(set (match_dup 0) (xor:DI (match_dup 1) (match_dup 3)))
5615 (set (match_dup 0) (xor:DI (match_dup 0) (match_dup 4)))]
5618 operands[3] = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
5619 operands[4] = GEN_INT (INTVAL (operands[2]) & 0xffff);
5622 (define_insn "*eqvdi3_internal1"
5623 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5624 (not:DI (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
5625 (match_operand:DI 2 "gpc_reg_operand" "r"))))]
5629 (define_insn "*eqvdi3_internal2"
5630 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
5631 (compare:CC (not:DI (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
5632 (match_operand:DI 2 "gpc_reg_operand" "r")))
5634 (clobber (match_scratch:DI 3 "=r"))]
5637 [(set_attr "type" "compare")])
5639 (define_insn "*eqvdi3_internal3"
5640 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
5641 (compare:CC (not:DI (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
5642 (match_operand:DI 2 "gpc_reg_operand" "r")))
5644 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
5645 (not:DI (xor:DI (match_dup 1) (match_dup 2))))]
5648 [(set_attr "type" "compare")])
5650 (define_insn "*andcdi3_internal1"
5651 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5652 (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
5653 (match_operand:DI 2 "gpc_reg_operand" "r")))]
5657 (define_insn "*andcdi3_internal2"
5658 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
5659 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
5660 (match_operand:DI 2 "gpc_reg_operand" "r"))
5662 (clobber (match_scratch:DI 3 "=r"))]
5665 [(set_attr "type" "compare")])
5667 (define_insn "*andcdi3_internal3"
5668 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
5669 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
5670 (match_operand:DI 2 "gpc_reg_operand" "r"))
5672 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
5673 (and:DI (not:DI (match_dup 1)) (match_dup 2)))]
5676 [(set_attr "type" "compare")])
5678 (define_insn "*iorcdi3_internal1"
5679 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5680 (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
5681 (match_operand:DI 2 "gpc_reg_operand" "r")))]
5685 (define_insn "*iorcdi3_inernal2"
5686 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
5687 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
5688 (match_operand:DI 2 "gpc_reg_operand" "r"))
5690 (clobber (match_scratch:DI 3 "=r"))]
5693 [(set_attr "type" "compare")])
5695 (define_insn "*iorcdi3_internal3"
5696 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
5697 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
5698 (match_operand:DI 2 "gpc_reg_operand" "r"))
5700 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
5701 (ior:DI (not:DI (match_dup 1)) (match_dup 2)))]
5704 [(set_attr "type" "compare")])
5706 (define_insn "*nanddi3_internal1"
5707 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5708 (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
5709 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))))]
5713 (define_insn "*nanddi3_internal2"
5714 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
5715 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
5716 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r")))
5718 (clobber (match_scratch:DI 3 "=r"))]
5721 [(set_attr "type" "compare")])
5723 (define_insn "*nanddi3_internal3"
5724 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
5725 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
5726 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r")))
5728 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
5729 (ior:DI (not:DI (match_dup 1)) (not:DI (match_dup 2))))]
5732 [(set_attr "type" "compare")])
5734 (define_insn "*nordi3_internal1"
5735 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5736 (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
5737 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))))]
5741 (define_insn "*nordi3_internal2"
5742 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
5743 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
5744 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r")))
5746 (clobber (match_scratch:DI 3 "=r"))]
5749 [(set_attr "type" "compare")])
5751 (define_insn "*nordi3_internal3"
5752 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
5753 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
5754 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r")))
5756 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
5757 (and:DI (not:DI (match_dup 1)) (not:DI (match_dup 2))))]
5760 [(set_attr "type" "compare")])
5762 ;; Now define ways of moving data around.
5764 ;; Elf specific ways of loading addresses for non-PIC code.
5765 ;; The output of this could be r0, but we limit it to base
5766 ;; registers, since almost all uses of this will need it
5767 ;; in a base register shortly.
5768 (define_insn "elf_high"
5769 [(set (match_operand:SI 0 "register_operand" "=b")
5770 (high:SI (match_operand 1 "" "")))]
5771 "TARGET_ELF && !TARGET_64BIT"
5772 "{liu|lis} %0,%1@ha")
5774 (define_insn "elf_low"
5775 [(set (match_operand:SI 0 "register_operand" "=r")
5776 (lo_sum:SI (match_operand:SI 1 "register_operand" "b")
5777 (match_operand 2 "" "")))]
5778 "TARGET_ELF && !TARGET_64BIT"
5779 "{cal|la} %0,%2@l(%1)")
5781 ;; Set up a register with a value from the GOT table
5783 (define_expand "movsi_got"
5784 [(set (match_operand:SI 0 "register_operand" "")
5785 (unspec [(match_operand:SI 1 "got_operand" "")
5787 "(DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && flag_pic == 1"
5790 if (GET_CODE (operands[1]) == CONST)
5792 rtx offset = const0_rtx;
5793 HOST_WIDE_INT value;
5795 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
5796 value = INTVAL (offset);
5799 rtx tmp = ((reload_in_progress || reload_completed)
5801 : gen_reg_rtx (Pmode));
5802 emit_insn (gen_movsi_got (tmp, operands[1]));
5803 emit_insn (gen_addsi3 (operands[0], tmp, offset));
5808 operands[2] = rs6000_got_register (operands[1]);
5811 (define_insn "*movsi_got_internal"
5812 [(set (match_operand:SI 0 "register_operand" "=r")
5813 (unspec [(match_operand:SI 1 "got_no_const_operand" "")
5814 (match_operand:SI 2 "register_operand" "b")] 8))]
5815 "(DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && flag_pic == 1"
5816 "{l|lwz} %0,%a1@got(%2)"
5817 [(set_attr "type" "load")])
5819 ;; Sometimes, though, the GOT `register' will be on the stack. Deal with
5820 ;; this case specially.
5821 ;; Force final to split this insn (if it hasn't been split already) to
5822 ;; avoid having to create a suitable output template.
5823 (define_insn "*movsi_got_internal_mem"
5824 [(set (match_operand:SI 0 "register_operand" "=r")
5825 (unspec [(match_operand:SI 1 "got_no_const_operand" "")
5826 (match_operand:SI 2 "memory_operand" "m")] 8))]
5827 "(DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
5829 && (reload_in_progress || reload_completed)"
5831 [(set_attr "type" "load")
5832 (set_attr "length" "8")])
5834 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
5835 ;; didn't get allocated to a hard register.
5837 [(set (match_operand:SI 0 "register_operand" "=r")
5838 (unspec [(match_operand:SI 1 "got_no_const_operand" "")
5839 (match_operand:SI 2 "memory_operand" "m")] 8))]
5840 "(DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
5842 && (reload_in_progress || reload_completed)"
5843 [(set (match_dup 0) (match_dup 2))
5844 (set (match_dup 0) (unspec [(match_dup 1)(match_dup 0)] 8))]
5847 ;; For SI, we special-case integers that can't be loaded in one insn. We
5848 ;; do the load 16-bits at a time. We could do this by loading from memory,
5849 ;; and this is even supposed to be faster, but it is simpler not to get
5850 ;; integers in the TOC.
5851 (define_expand "movsi"
5852 [(set (match_operand:SI 0 "general_operand" "")
5853 (match_operand:SI 1 "any_operand" ""))]
5857 if (GET_CODE (operands[0]) != REG)
5858 operands[1] = force_reg (SImode, operands[1]);
5860 /* Convert a move of a CONST_DOUBLE into a CONST_INT */
5861 if (GET_CODE (operands[1]) == CONST_DOUBLE)
5862 operands[1] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
5864 /* Only a tiny bit of handling for CONSTANT_P_RTX is necessary. */
5865 if (GET_CODE (operands[1]) == CONSTANT_P_RTX)
5867 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
5871 /* Use default pattern for address of ELF small data */
5873 && (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
5874 && (GET_CODE (operands[1]) == SYMBOL_REF || GET_CODE (operands[1]) == CONST)
5875 && small_data_operand (operands[1], SImode))
5877 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
5881 if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
5882 && flag_pic == 1 && got_operand (operands[1], SImode))
5884 emit_insn (gen_movsi_got (operands[0], operands[1]));
5888 if (TARGET_ELF && TARGET_NO_TOC && !TARGET_64BIT
5890 && CONSTANT_P (operands[1])
5891 && GET_CODE (operands[1]) != HIGH
5892 && GET_CODE (operands[1]) != CONST_INT)
5894 rtx target = (reload_completed || reload_in_progress)
5895 ? operands[0] : gen_reg_rtx (SImode);
5897 /* If this is a function address on -mcall-aixdesc or -mcall-nt,
5898 convert it to the address of the descriptor. */
5899 if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)
5900 && GET_CODE (operands[1]) == SYMBOL_REF
5901 && XSTR (operands[1], 0)[0] == '.')
5903 char *name = XSTR (operands[1], 0);
5905 while (*name == '.')
5907 new_ref = gen_rtx_SYMBOL_REF (Pmode, name);
5908 CONSTANT_POOL_ADDRESS_P (new_ref) = CONSTANT_POOL_ADDRESS_P (operands[1]);
5909 SYMBOL_REF_FLAG (new_ref) = SYMBOL_REF_FLAG (operands[1]);
5910 SYMBOL_REF_USED (new_ref) = SYMBOL_REF_USED (operands[1]);
5911 operands[1] = new_ref;
5914 emit_insn (gen_elf_high (target, operands[1]));
5915 emit_insn (gen_elf_low (operands[0], target, operands[1]));
5919 if (GET_CODE (operands[1]) == CONST
5920 && DEFAULT_ABI == ABI_NT
5921 && !side_effects_p (operands[0]))
5923 rtx const_term = const0_rtx;
5924 rtx sym = eliminate_constant_term (XEXP (operands[1], 0), &const_term);
5925 if (sym && GET_CODE (const_term) == CONST_INT
5926 && (GET_CODE (sym) == SYMBOL_REF || GET_CODE (sym) == LABEL_REF))
5928 unsigned HOST_WIDE_INT value = INTVAL (const_term);
5929 int new_reg_p = (flag_expensive_optimizations
5930 && !reload_completed
5931 && !reload_in_progress);
5932 rtx tmp1 = (new_reg_p && value != 0) ? gen_reg_rtx (SImode) : operands[0];
5934 emit_insn (gen_movsi (tmp1, sym));
5935 if (INTVAL (const_term) != 0)
5936 emit_insn (gen_addsi3 (operands[0], tmp1, GEN_INT (value)));
5940 rs6000_fatal_bad_address (operands[1]);
5943 if ((!TARGET_WINDOWS_NT || DEFAULT_ABI != ABI_NT)
5944 && CONSTANT_P (operands[1])
5945 && GET_CODE (operands[1]) != CONST_INT
5946 && GET_CODE (operands[1]) != HIGH
5947 && ! LEGITIMATE_CONSTANT_POOL_ADDRESS_P (operands[1]))
5949 /* Emit a USE operation so that the constant isn't deleted if
5950 expensive optimizations are turned on because nobody
5951 references it. This should only be done for operands that
5952 contain SYMBOL_REFs with CONSTANT_POOL_ADDRESS_P set.
5953 This should not be done for operands that contain LABEL_REFs.
5954 For now, we just handle the obvious case. */
5955 if (GET_CODE (operands[1]) != LABEL_REF)
5956 emit_insn (gen_rtx_USE (VOIDmode, operands[1]));
5958 /* If we are to limit the number of things we put in the TOC and
5959 this is a symbol plus a constant we can add in one insn,
5960 just put the symbol in the TOC and add the constant. Don't do
5961 this if reload is in progress. */
5962 if (GET_CODE (operands[1]) == CONST
5963 && TARGET_NO_SUM_IN_TOC && ! reload_in_progress
5964 && GET_CODE (XEXP (operands[1], 0)) == PLUS
5965 && add_operand (XEXP (XEXP (operands[1], 0), 1), SImode)
5966 && (GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == LABEL_REF
5967 || GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == SYMBOL_REF)
5968 && ! side_effects_p (operands[0]))
5970 rtx sym = force_const_mem (SImode, XEXP (XEXP (operands[1], 0), 0));
5971 rtx other = XEXP (XEXP (operands[1], 0), 1);
5973 emit_insn (gen_addsi3 (operands[0], force_reg (SImode, sym), other));
5977 operands[1] = force_const_mem (SImode, operands[1]);
5978 if (! memory_address_p (SImode, XEXP (operands[1], 0))
5979 && ! reload_in_progress)
5980 operands[1] = change_address (operands[1], SImode,
5981 XEXP (operands[1], 0));
5986 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h")
5987 (match_operand:SI 1 "input_operand" "r,U,m,r,I,J,n,R,*h,r,r,0"))]
5988 "gpc_reg_operand (operands[0], SImode)
5989 || gpc_reg_operand (operands[1], SImode)"
5993 {l%U1%X1|lwz%U1%X1} %0,%1
5994 {st%U0%X0|stw%U0%X0} %1,%0
6003 [(set_attr "type" "*,*,load,store,*,*,*,*,*,*,mtjmpr,*")
6004 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4")])
6006 ;; Split a load of a large constant into the appropriate two-insn
6010 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6011 (match_operand:SI 1 "const_int_operand" ""))]
6012 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
6013 && (INTVAL (operands[1]) & 0xffff) != 0"
6017 (ior:SI (match_dup 0)
6021 operands[2] = GEN_INT (INTVAL (operands[1]) & 0xffff0000);
6022 operands[3] = GEN_INT (INTVAL (operands[1]) & 0xffff);
6026 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
6027 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
6029 (set (match_operand:SI 0 "gpc_reg_operand" "=r") (match_dup 1))]
6032 [(set_attr "type" "compare")])
6034 (define_expand "movhi"
6035 [(set (match_operand:HI 0 "general_operand" "")
6036 (match_operand:HI 1 "any_operand" ""))]
6040 if (GET_CODE (operands[0]) != REG)
6041 operands[1] = force_reg (HImode, operands[1]);
6043 if (CONSTANT_P (operands[1])
6044 && GET_CODE (operands[1]) != CONST_INT)
6046 operands[1] = force_const_mem (HImode, operands[1]);
6047 if (! memory_address_p (HImode, XEXP (operands[1], 0))
6048 && ! reload_in_progress)
6049 operands[1] = change_address (operands[1], HImode,
6050 XEXP (operands[1], 0));
6055 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
6056 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
6057 "gpc_reg_operand (operands[0], HImode)
6058 || gpc_reg_operand (operands[1], HImode)"
6068 [(set_attr "type" "*,load,store,*,*,*,mtjmpr,*")])
6070 (define_expand "movqi"
6071 [(set (match_operand:QI 0 "general_operand" "")
6072 (match_operand:QI 1 "any_operand" ""))]
6076 if (GET_CODE (operands[0]) != REG)
6077 operands[1] = force_reg (QImode, operands[1]);
6079 if (CONSTANT_P (operands[1])
6080 && GET_CODE (operands[1]) != CONST_INT)
6082 operands[1] = force_const_mem (QImode, operands[1]);
6083 if (! memory_address_p (QImode, XEXP (operands[1], 0))
6084 && ! reload_in_progress)
6085 operands[1] = change_address (operands[1], QImode,
6086 XEXP (operands[1], 0));
6091 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
6092 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
6093 "gpc_reg_operand (operands[0], QImode)
6094 || gpc_reg_operand (operands[1], QImode)"
6104 [(set_attr "type" "*,load,store,*,*,*,mtjmpr,*")])
6106 ;; Here is how to move condition codes around. When we store CC data in
6107 ;; an integer register or memory, we store just the high-order 4 bits.
6108 ;; This lets us not shift in the most common case of CR0.
6109 (define_expand "movcc"
6110 [(set (match_operand:CC 0 "nonimmediate_operand" "")
6111 (match_operand:CC 1 "nonimmediate_operand" ""))]
6116 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,y,r,r,r,r,m")
6117 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,m,r"))]
6118 "register_operand (operands[0], CCmode)
6119 || register_operand (operands[1], CCmode)"
6123 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
6125 mfcr %0\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
6127 {l%U1%X1|lwz%U1%X1} %0,%1
6128 {st%U0%U1|stw%U0%U1} %1,%0"
6129 [(set_attr "type" "*,*,*,compare,*,*,load,store")
6130 (set_attr "length" "*,*,12,*,8,*,*,*")])
6132 ;; For floating-point, we normally deal with the floating-point registers
6133 ;; unless -msoft-float is used. The sole exception is that parameter passing
6134 ;; can produce floating-point values in fixed-point registers. Unless the
6135 ;; value is a simple constant or already in memory, we deal with this by
6136 ;; allocating memory and copying the value explicitly via that memory location.
6137 (define_expand "movsf"
6138 [(set (match_operand:SF 0 "nonimmediate_operand" "")
6139 (match_operand:SF 1 "any_operand" ""))]
6143 /* If we are called from reload, we might be getting a SUBREG of a hard
6144 reg. So expand it. */
6145 if (GET_CODE (operands[0]) == SUBREG
6146 && GET_CODE (SUBREG_REG (operands[0])) == REG
6147 && REGNO (SUBREG_REG (operands[0])) < FIRST_PSEUDO_REGISTER)
6148 operands[0] = alter_subreg (operands[0]);
6149 if (GET_CODE (operands[1]) == SUBREG
6150 && GET_CODE (SUBREG_REG (operands[1])) == REG
6151 && REGNO (SUBREG_REG (operands[1])) < FIRST_PSEUDO_REGISTER)
6152 operands[1] = alter_subreg (operands[1]);
6154 if (GET_CODE (operands[0]) == MEM)
6156 /* If operands[1] is a register, it may have double-precision data
6157 in it, so truncate it to single precision. We need not do
6158 this for POWERPC. */
6159 if (! TARGET_POWERPC && TARGET_HARD_FLOAT
6160 && GET_CODE (operands[1]) == REG
6161 && (FP_REGNO_P (REGNO (operands[1]))
6162 || REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER))
6165 = reload_in_progress ? operands[1] : gen_reg_rtx (SFmode);
6166 emit_insn (gen_aux_truncdfsf2 (newreg, operands[1]));
6167 operands[1] = newreg;
6170 operands[1] = force_reg (SFmode, operands[1]);
6173 if (CONSTANT_P (operands[1]) && TARGET_HARD_FLOAT)
6175 operands[1] = force_const_mem (SFmode, operands[1]);
6176 if (! memory_address_p (SFmode, XEXP (operands[1], 0))
6177 && ! reload_in_progress)
6178 operands[1] = change_address (operands[1], SFmode,
6179 XEXP (operands[1], 0));
6184 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6185 (match_operand:SF 1 "const_double_operand" ""))]
6187 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
6188 || (GET_CODE (operands[0]) == SUBREG
6189 && GET_CODE (SUBREG_REG (operands[0])) == REG
6190 && REGNO (SUBREG_REG (operands[0])) <= 31))"
6191 [(set (match_dup 2) (match_dup 3))]
6197 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
6198 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
6200 if (! TARGET_POWERPC64)
6201 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
6203 operands[2] = gen_lowpart (SImode, operands[0]);
6205 operands[3] = GEN_INT(l);
6208 (define_insn "*movsf_hardfloat"
6209 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,!r,!r")
6210 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,G,Fn"))]
6211 "(gpc_reg_operand (operands[0], SFmode)
6212 || gpc_reg_operand (operands[1], SFmode)) && TARGET_HARD_FLOAT"
6215 {l%U1%X1|lwz%U1%X1} %0,%1
6216 {st%U0%X0|stw%U0%X0} %1,%0
6222 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*")
6223 (set_attr "length" "4,4,4,4,4,4,4,8")])
6225 (define_insn "*movsf_softfloat"
6226 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,r")
6227 (match_operand:SF 1 "input_operand" "r,m,r,I,J,R,G,Fn"))]
6228 "(gpc_reg_operand (operands[0], SFmode)
6229 || gpc_reg_operand (operands[1], SFmode)) && TARGET_SOFT_FLOAT"
6232 {l%U1%X1|lwz%U1%X1} %0,%1
6233 {st%U0%X0|stw%U0%X0} %1,%0
6239 [(set_attr "type" "*,load,store,*,*,*,*,*")
6240 (set_attr "length" "4,4,4,4,4,4,4,8")])
6243 (define_expand "movdf"
6244 [(set (match_operand:DF 0 "nonimmediate_operand" "")
6245 (match_operand:DF 1 "any_operand" ""))]
6249 if (GET_CODE (operands[0]) != REG)
6250 operands[1] = force_reg (DFmode, operands[1]);
6252 if (CONSTANT_P (operands[1]) && ! easy_fp_constant (operands[1], DFmode))
6254 operands[1] = force_const_mem (DFmode, operands[1]);
6255 if (! memory_address_p (DFmode, XEXP (operands[1], 0))
6256 && ! reload_in_progress)
6257 operands[1] = change_address (operands[1], DFmode,
6258 XEXP (operands[1], 0));
6263 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6264 (match_operand:DF 1 "const_int_operand" ""))]
6265 "! TARGET_POWERPC64 && reload_completed
6266 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
6267 || (GET_CODE (operands[0]) == SUBREG
6268 && GET_CODE (SUBREG_REG (operands[0])) == REG
6269 && REGNO (SUBREG_REG (operands[0])) <= 31))"
6270 [(set (match_dup 2) (match_dup 4))
6271 (set (match_dup 3) (match_dup 1))]
6274 int endian = (WORDS_BIG_ENDIAN == 0);
6275 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
6276 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
6277 operands[4] = (INTVAL (operands[1]) & 0x80000000) ? constm1_rtx : const0_rtx;
6281 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6282 (match_operand:DF 1 "const_double_operand" ""))]
6283 "! TARGET_POWERPC64 && reload_completed
6284 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
6285 || (GET_CODE (operands[0]) == SUBREG
6286 && GET_CODE (SUBREG_REG (operands[0])) == REG
6287 && REGNO (SUBREG_REG (operands[0])) <= 31))"
6288 [(set (match_dup 2) (match_dup 4))
6289 (set (match_dup 3) (match_dup 5))]
6292 int endian = (WORDS_BIG_ENDIAN == 0);
6296 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
6297 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
6299 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
6300 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
6301 operands[4] = GEN_INT (l[endian]);
6302 operands[5] = GEN_INT (l[1 - endian]);
6306 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6307 (match_operand:DF 1 "easy_fp_constant" ""))]
6308 "TARGET_POWERPC64 && reload_completed
6309 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
6310 || (GET_CODE (operands[0]) == SUBREG
6311 && GET_CODE (SUBREG_REG (operands[0])) == REG
6312 && REGNO (SUBREG_REG (operands[0])) <= 31))"
6313 [(set (match_dup 2) (match_dup 3))]
6316 int endian = (WORDS_BIG_ENDIAN == 0);
6320 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
6321 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
6323 operands[2] = gen_lowpart (DImode, operands[0]);
6324 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
6325 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
6328 ;; Don't have reload use general registers to load a constant. First,
6329 ;; it might not work if the output operand is the equivalent of
6330 ;; a non-offsettable memref, but also it is less efficient than loading
6331 ;; the constant into an FP register, since it will probably be used there.
6332 ;; The "??" is a kludge until we can figure out a more reasonable way
6333 ;; of handling these non-offsettable values.
6334 (define_insn "*movdf_hardfloat32"
6335 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,o,!r,!r,!r,f,f,m")
6336 (match_operand:DF 1 "input_operand" "r,o,r,G,H,F,f,m,f"))]
6337 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT
6338 && (register_operand (operands[0], DFmode)
6339 || register_operand (operands[1], DFmode))"
6342 switch (which_alternative)
6347 /* We normally copy the low-numbered register first. However, if
6348 the first register operand 0 is the same as the second register of
6349 operand 1, we must copy in the opposite order. */
6350 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
6351 return \"mr %L0,%L1\;mr %0,%1\";
6353 return \"mr %0,%1\;mr %L0,%L1\";
6355 /* If the low-address word is used in the address, we must load it
6356 last. Otherwise, load it first. Note that we cannot have
6357 auto-increment in that case since the address register is known to be
6359 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
6361 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
6363 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
6365 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
6371 return \"fmr %0,%1\";
6373 return \"lfd%U1%X1 %0,%1\";
6375 return \"stfd%U0%X0 %1,%0\";
6378 [(set_attr "type" "*,load,store,*,*,*,fp,fpload,fpstore")
6379 (set_attr "length" "8,8,8,8,12,16,*,*,*")])
6381 (define_insn "*movdf_softfloat32"
6382 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
6383 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
6384 "! TARGET_POWERPC64 && TARGET_SOFT_FLOAT
6385 && (register_operand (operands[0], DFmode)
6386 || register_operand (operands[1], DFmode))"
6389 switch (which_alternative)
6394 /* We normally copy the low-numbered register first. However, if
6395 the first register operand 0 is the same as the second register of
6396 operand 1, we must copy in the opposite order. */
6397 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
6398 return \"mr %L0,%L1\;mr %0,%1\";
6400 return \"mr %0,%1\;mr %L0,%L1\";
6402 /* If the low-address word is used in the address, we must load it
6403 last. Otherwise, load it first. Note that we cannot have
6404 auto-increment in that case since the address register is known to be
6406 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
6408 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
6410 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
6412 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
6419 [(set_attr "type" "*,load,store,*,*,*")
6420 (set_attr "length" "8,8,8,8,12,16")])
6422 (define_insn "*movdf_hardfloat64"
6423 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,!r,!r,!r,f,f,m")
6424 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F,f,m,f"))]
6425 "TARGET_POWERPC64 && TARGET_HARD_FLOAT
6426 && (register_operand (operands[0], DFmode)
6427 || register_operand (operands[1], DFmode))"
6438 [(set_attr "type" "*,load,store,*,*,*,fp,fpload,fpstore")
6439 (set_attr "length" "4,4,4,8,12,16,4,4,4")])
6441 (define_insn "*movdf_softfloat64"
6442 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
6443 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
6444 "TARGET_POWERPC64 && TARGET_SOFT_FLOAT
6445 && (register_operand (operands[0], DFmode)
6446 || register_operand (operands[1], DFmode))"
6454 [(set_attr "type" "*,load,store,*,*,*")
6455 (set_attr "length" "*,*,*,8,12,16")])
6457 ;; Next come the multi-word integer load and store and the load and store
6459 (define_expand "movdi"
6460 [(set (match_operand:DI 0 "general_operand" "")
6461 (match_operand:DI 1 "any_operand" ""))]
6465 if (GET_CODE (operands[0]) != REG)
6466 operands[1] = force_reg (DImode, operands[1]);
6468 /* Convert a move of a CONST_DOUBLE into a CONST_INT
6469 only if sign-extended lower-half for 32-bit host. */
6470 if (GET_CODE (operands[1]) == CONST_DOUBLE
6471 #if HOST_BITS_PER_WIDE_INT == 32
6472 && ((CONST_DOUBLE_HIGH (operands[1]) == 0
6473 && (CONST_DOUBLE_LOW (operands[1]) & 0x80000000) == 0)
6474 || (CONST_DOUBLE_HIGH (operands[1]) == 0xffffffff
6475 && (CONST_DOUBLE_LOW (operands[1]) & 0x80000000) != 0))
6478 operands[1] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
6480 /* Only a tiny bit of handling for CONSTANT_P_RTX is necessary. */
6481 if (GET_CODE (operands[1]) == CONSTANT_P_RTX)
6483 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
6488 && CONSTANT_P (operands[1])
6489 #if HOST_BITS_PER_WIDE_INT == 32
6490 && GET_CODE (operands[1]) != CONST_INT
6492 && ! easy_fp_constant (operands[1], DImode)
6493 && ! LEGITIMATE_CONSTANT_POOL_ADDRESS_P (operands[1]))
6495 /* Emit a USE operation so that the constant isn't deleted if
6496 expensive optimizations are turned on because nobody
6497 references it. This should only be done for operands that
6498 contain SYMBOL_REFs with CONSTANT_POOL_ADDRESS_P set.
6499 This should not be done for operands that contain LABEL_REFs.
6500 For now, we just handle the obvious case. */
6501 if (GET_CODE (operands[1]) != LABEL_REF)
6502 emit_insn (gen_rtx_USE (VOIDmode, operands[1]));
6504 /* If we are to limit the number of things we put in the TOC and
6505 this is a symbol plus a constant we can add in one insn,
6506 just put the symbol in the TOC and add the constant. Don't do
6507 this if reload is in progress. */
6508 if (GET_CODE (operands[1]) == CONST
6509 && TARGET_NO_SUM_IN_TOC && ! reload_in_progress
6510 && GET_CODE (XEXP (operands[1], 0)) == PLUS
6511 && add_operand (XEXP (XEXP (operands[1], 0), 1), DImode)
6512 && (GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == LABEL_REF
6513 || GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == SYMBOL_REF)
6514 && ! side_effects_p (operands[0]))
6516 rtx sym = force_const_mem (DImode, XEXP (XEXP (operands[1], 0), 0));
6517 rtx other = XEXP (XEXP (operands[1], 0), 1);
6519 emit_insn (gen_adddi3 (operands[0], force_reg (DImode, sym), other));
6523 operands[1] = force_const_mem (DImode, operands[1]);
6524 if (! memory_address_p (DImode, XEXP (operands[1], 0))
6525 && ! reload_in_progress)
6526 operands[1] = change_address (operands[1], DImode,
6527 XEXP (operands[1], 0));
6531 (define_insn "*movdi_32"
6532 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,f,f,m,r,r,r,r,r")
6533 (match_operand:DI 1 "input_operand" "r,m,r,f,m,f,IJK,n,G,H,F"))]
6535 && (gpc_reg_operand (operands[0], DImode)
6536 || gpc_reg_operand (operands[1], DImode))"
6539 switch (which_alternative)
6544 /* We normally copy the low-numbered register first. However, if
6545 the first register operand 0 is the same as the second register of
6546 operand 1, we must copy in the opposite order. */
6547 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
6548 return \"mr %L0,%L1\;mr %0,%1\";
6550 return \"mr %0,%1\;mr %L0,%L1\";
6552 /* If the low-address word is used in the address, we must load it
6553 last. Otherwise, load it first. Note that we cannot have
6554 auto-increment in that case since the address register is known to be
6556 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
6558 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
6560 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
6562 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
6564 return \"fmr %0,%1\";
6566 return \"lfd%U1%X1 %0,%1\";
6568 return \"stfd%U0%X0 %1,%0\";
6577 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*,*,*,*")
6578 (set_attr "length" "8,8,8,*,*,*,8,12,8,12,16")])
6581 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6582 (match_operand:DI 1 "const_int_operand" ""))]
6583 "! TARGET_POWERPC64 && reload_completed"
6584 [(set (match_dup 2) (match_dup 4))
6585 (set (match_dup 3) (match_dup 1))]
6588 operands[2] = gen_rtx_SUBREG (SImode, operands[0], WORDS_BIG_ENDIAN == 0);
6589 operands[3] = gen_rtx_SUBREG (SImode, operands[0], WORDS_BIG_ENDIAN != 0);
6590 #if HOST_BITS_PER_WIDE_INT == 32
6591 operands[4] = (INTVAL (operands[1]) & 0x80000000) ? constm1_rtx : const0_rtx;
6593 operands[4] = (HOST_WIDE_INT) INTVAL (operands[1]) >> 32;
6594 operands[1] = INTVAL (operands[1]) & 0xffffffff;
6599 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6600 (match_operand:DI 1 "const_double_operand" ""))]
6601 "HOST_BITS_PER_WIDE_INT == 32 && ! TARGET_POWERPC64 && reload_completed"
6602 [(set (match_dup 2) (match_dup 4))
6603 (set (match_dup 3) (match_dup 5))]
6606 operands[2] = gen_rtx_SUBREG (SImode, operands[0], WORDS_BIG_ENDIAN == 0);
6607 operands[3] = gen_rtx_SUBREG (SImode, operands[0], WORDS_BIG_ENDIAN != 0);
6608 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
6609 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
6612 (define_insn "*movdi_64"
6613 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,f,f,m,r,*h,*h")
6614 (match_operand:DI 1 "input_operand" "r,m,r,I,J,nF,R,f,m,f,*h,r,0"))]
6616 && (gpc_reg_operand (operands[0], DImode)
6617 || gpc_reg_operand (operands[1], DImode))"
6632 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,*,mtjmpr,*")
6633 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
6636 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6637 (match_operand:DI 1 "const_double_operand" "F"))]
6638 "TARGET_POWERPC64 && GET_CODE (operands[1]) == CONST_DOUBLE
6639 && num_insns_constant (operands[1], DImode) == 1"
6642 return ((unsigned HOST_WIDE_INT)
6643 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
6644 ? \"li %0,%1\" : \"lis %0,%v1\";
6648 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6649 (match_operand:DI 1 "const_int_operand" ""))]
6650 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
6651 && num_insns_constant (operands[1], DImode) > 1"
6655 (ior:DI (match_dup 0)
6659 operands[2] = GEN_INT (INTVAL (operands[1]) & 0xffff0000);
6660 operands[3] = GEN_INT (INTVAL (operands[1]) & 0xffff);
6664 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6665 (match_operand:DI 1 "const_double_operand" ""))]
6666 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
6667 && GET_CODE (operands[1]) == CONST_DOUBLE
6668 && ((CONST_DOUBLE_HIGH (operands[1]) == 0
6669 && (CONST_DOUBLE_LOW (operands[1]) & 0x80000000) == 0)
6670 || (CONST_DOUBLE_HIGH (operands[1]) == 0xffffffff
6671 && (CONST_DOUBLE_LOW (operands[1]) & 0x80000000) != 0))"
6675 (ior:DI (match_dup 0)
6679 operands[2] = GEN_INT (CONST_DOUBLE_LOW (operands[1]) & 0xffff0000);
6680 operands[3] = GEN_INT (CONST_DOUBLE_LOW (operands[1]) & 0xffff);
6684 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6685 (match_operand:DI 1 "const_double_operand" ""))]
6686 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
6687 && GET_CODE (operands[1]) == CONST_DOUBLE
6688 && CONST_DOUBLE_HIGH (operands[1]) == 0
6689 && (CONST_DOUBLE_LOW (operands[1]) & 0x80000000) != 0"
6693 (zero_extend:DI (subreg:SI (match_dup 0) 0)))]
6695 { operands[2] = GEN_INT (CONST_DOUBLE_LOW (operands[1])); }")
6698 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6699 (match_operand:DI 1 "const_double_operand" ""))]
6700 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
6701 && GET_CODE (operands[1]) == CONST_DOUBLE
6702 && CONST_DOUBLE_LOW (operands[1]) == 0"
6706 (ashift:DI (match_dup 0)
6709 { operands[2] = GEN_INT (CONST_DOUBLE_HIGH (operands[1])); }")
6711 ;; Generate all one-bits and clear left or right.
6712 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
6714 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6715 (match_operand:DI 1 "mask64_operand" ""))]
6716 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
6717 [(set (match_dup 0) (const_int -1))
6719 (and:DI (rotate:DI (match_dup 0)
6724 ;; Split a load of a large constant into the appropriate five-instruction
6725 ;; sequence. Handle anything in a constant number of insns.
6726 ;; When non-easy constants can go in the TOC, this should use
6727 ;; easy_fp_constant predicate.
6729 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6730 (match_operand:DI 1 "const_double_operand" ""))]
6731 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
6735 (ashift:DI (match_dup 0)
6738 (ior:DI (match_dup 0)
6745 if (GET_CODE (operands[1]) == CONST_DOUBLE)
6747 low = CONST_DOUBLE_LOW (operands[1]);
6748 high = CONST_DOUBLE_HIGH (operands[1]);
6751 #if HOST_BITS_PER_WIDE_INT == 32
6753 low = INTVAL (operands[1]);
6754 high = (low < 0) ? ~0 : 0;
6758 low = INTVAL (operands[1]) & 0xffffffff;
6759 high = (HOST_WIDE_INT) INTVAL (operands[1]) >> 32;
6763 operands[2] = GEN_INT (high);
6764 operands[3] = GEN_INT (low);
6768 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
6769 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r")
6771 (set (match_operand:DI 0 "gpc_reg_operand" "=r") (match_dup 1))]
6774 [(set_attr "type" "compare")])
6776 ;; TImode is similar, except that we usually want to compute the address into
6777 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
6778 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
6779 (define_expand "movti"
6780 [(parallel [(set (match_operand:TI 0 "general_operand" "")
6781 (match_operand:TI 1 "general_operand" ""))
6782 (clobber (scratch:SI))])]
6783 "TARGET_STRING || TARGET_POWERPC64"
6786 if (GET_CODE (operands[0]) == MEM)
6787 operands[1] = force_reg (TImode, operands[1]);
6789 if (GET_CODE (operands[0]) == MEM
6790 && GET_CODE (XEXP (operands[0], 0)) != REG
6791 && ! reload_in_progress)
6792 operands[0] = change_address (operands[0], TImode,
6793 copy_addr_to_reg (XEXP (operands[0], 0)));
6795 if (GET_CODE (operands[1]) == MEM
6796 && GET_CODE (XEXP (operands[1], 0)) != REG
6797 && ! reload_in_progress)
6798 operands[1] = change_address (operands[1], TImode,
6799 copy_addr_to_reg (XEXP (operands[1], 0)));
6802 ;; We say that MQ is clobbered in the last alternative because the first
6803 ;; alternative would never get used otherwise since it would need a reload
6804 ;; while the 2nd alternative would not. We put memory cases first so they
6805 ;; are preferred. Otherwise, we'd try to reload the output instead of
6806 ;; giving the SCRATCH mq.
6807 (define_insn "*movti_power"
6808 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r")
6809 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))
6810 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X"))]
6811 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
6812 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
6815 switch (which_alternative)
6821 return \"{stsi|stswi} %1,%P0,16\";
6824 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
6827 /* Normally copy registers with lowest numbered register copied first.
6828 But copy in the other order if the first register of the output
6829 is the second, third, or fourth register in the input. */
6830 if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
6831 && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
6832 return \"mr %Z0,%Z1\;mr %Y0,%Y1\;mr %L0,%L1\;mr %0,%1\";
6834 return \"mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1\";
6836 /* If the address is not used in the output, we can use lsi. Otherwise,
6837 fall through to generating four loads. */
6838 if (! reg_overlap_mentioned_p (operands[0], operands[1]))
6839 return \"{lsi|lswi} %0,%P1,16\";
6840 /* ... fall through ... */
6842 /* If the address register is the same as the register for the lowest-
6843 addressed word, load it last. Similarly for the next two words.
6844 Otherwise load lowest address to highest. */
6845 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
6847 return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
6848 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
6849 REGNO (operands[0]) + 2, operands[1], 0))
6850 return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
6851 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
6852 REGNO (operands[0]) + 3, operands[1], 0))
6853 return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
6855 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
6858 [(set_attr "type" "store,store,*,load,load")
6859 (set_attr "length" "*,16,16,*,16")])
6861 (define_insn "*movti_string"
6862 [(set (match_operand:TI 0 "reg_or_mem_operand" "=m,????r,????r")
6863 (match_operand:TI 1 "reg_or_mem_operand" "r,r,m"))
6864 (clobber (match_scratch:SI 2 "=X,X,X"))]
6865 "TARGET_STRING && !TARGET_POWER && ! TARGET_POWERPC64
6866 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
6869 switch (which_alternative)
6875 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
6878 /* Normally copy registers with lowest numbered register copied first.
6879 But copy in the other order if the first register of the output
6880 is the second, third, or fourth register in the input. */
6881 if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
6882 && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
6883 return \"mr %Z0,%Z1\;mr %Y0,%Y1\;mr %L0,%L1\;mr %0,%1\";
6885 return \"mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1\";
6887 /* If the address register is the same as the register for the lowest-
6888 addressed word, load it last. Similarly for the next two words.
6889 Otherwise load lowest address to highest. */
6890 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
6892 return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
6893 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
6894 REGNO (operands[0]) + 2, operands[1], 0))
6895 return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
6896 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
6897 REGNO (operands[0]) + 3, operands[1], 0))
6898 return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
6900 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
6903 [(set_attr "type" "store,*,load")
6904 (set_attr "length" "16,16,16")])
6906 (define_insn "*movti_ppc64"
6907 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,r,m")
6908 (match_operand:TI 1 "input_operand" "r,m,r"))]
6909 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
6910 || gpc_reg_operand (operands[1], TImode))"
6913 switch (which_alternative)
6918 /* We normally copy the low-numbered register first. However, if
6919 the first register operand 0 is the same as the second register of
6920 operand 1, we must copy in the opposite order. */
6921 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
6922 return \"mr %L0,%L1\;mr %0,%1\";
6924 return \"mr %0,%1\;mr %L0,%L1\";
6926 /* If the low-address word is used in the address, we must load it
6927 last. Otherwise, load it first. Note that we cannot have
6928 auto-increment in that case since the address register is known to be
6930 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
6932 return \"ld %L0,%L1\;ld %0,%1\";
6934 return \"ld%U1 %0,%1\;ld %L0,%L1\";
6936 return \"std%U0 %1,%0\;std %L1,%L0\";
6939 [(set_attr "type" "*,load,store")
6940 (set_attr "length" "8,8,8")])
6942 (define_expand "load_multiple"
6943 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
6944 (match_operand:SI 1 "" ""))
6945 (use (match_operand:SI 2 "" ""))])]
6954 /* Support only loading a constant number of fixed-point registers from
6955 memory and only bother with this if more than two; the machine
6956 doesn't support more than eight. */
6957 if (GET_CODE (operands[2]) != CONST_INT
6958 || INTVAL (operands[2]) <= 2
6959 || INTVAL (operands[2]) > 8
6960 || GET_CODE (operands[1]) != MEM
6961 || GET_CODE (operands[0]) != REG
6962 || REGNO (operands[0]) >= 32)
6965 count = INTVAL (operands[2]);
6966 regno = REGNO (operands[0]);
6968 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
6969 from = force_reg (SImode, XEXP (operands[1], 0));
6971 for (i = 0; i < count; i++)
6972 XVECEXP (operands[3], 0, i)
6973 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
6974 change_address (operands[1], SImode,
6975 plus_constant (from, i * 4)));
6979 [(match_parallel 0 "load_multiple_operation"
6980 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
6981 (mem:SI (match_operand:SI 2 "register_operand" "b")))])]
6985 /* We have to handle the case where the pseudo used to contain the address
6986 is assigned to one of the output registers. */
6988 int words = XVECLEN (operands[0], 0);
6991 if (XVECLEN (operands[0], 0) == 1)
6992 return \"{l|lwz} %1,0(%2)\";
6994 for (i = 0; i < words; i++)
6995 if (refers_to_regno_p (REGNO (operands[1]) + i,
6996 REGNO (operands[1]) + i + 1, operands[2], 0))
7000 xop[0] = operands[1];
7001 xop[1] = operands[2];
7002 xop[2] = GEN_INT (4 * (words-1));
7003 output_asm_insn (\"{lsi|lswi} %0,%1,%2\;{l|lwz} %1,%2(%1)\", xop);
7008 xop[0] = operands[1];
7009 xop[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
7010 xop[2] = GEN_INT (4 * (words-1));
7011 output_asm_insn (\"{cal %0,4(%0)|addi %0,%0,4}\;{lsi|lswi} %1,%0,%2\;{l|lwz} %0,-4(%0)\", xop);
7016 for (j = 0; j < words; j++)
7019 xop[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + j);
7020 xop[1] = operands[2];
7021 xop[2] = GEN_INT (j * 4);
7022 output_asm_insn (\"{l|lwz} %0,%2(%1)\", xop);
7024 xop[0] = operands[2];
7025 xop[1] = GEN_INT (i * 4);
7026 output_asm_insn (\"{l|lwz} %0,%1(%0)\", xop);
7031 return \"{lsi|lswi} %1,%2,%N0\";
7033 [(set_attr "type" "load")
7034 (set_attr "length" "32")])
7037 (define_expand "store_multiple"
7038 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
7039 (match_operand:SI 1 "" ""))
7040 (clobber (scratch:SI))
7041 (use (match_operand:SI 2 "" ""))])]
7050 /* Support only storing a constant number of fixed-point registers to
7051 memory and only bother with this if more than two; the machine
7052 doesn't support more than eight. */
7053 if (GET_CODE (operands[2]) != CONST_INT
7054 || INTVAL (operands[2]) <= 2
7055 || INTVAL (operands[2]) > 8
7056 || GET_CODE (operands[0]) != MEM
7057 || GET_CODE (operands[1]) != REG
7058 || REGNO (operands[1]) >= 32)
7061 count = INTVAL (operands[2]);
7062 regno = REGNO (operands[1]);
7064 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
7065 to = force_reg (SImode, XEXP (operands[0], 0));
7067 XVECEXP (operands[3], 0, 0)
7068 = gen_rtx_SET (VOIDmode, change_address (operands[0], SImode, to),
7070 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
7071 gen_rtx_SCRATCH (SImode));
7073 for (i = 1; i < count; i++)
7074 XVECEXP (operands[3], 0, i + 1)
7075 = gen_rtx_SET (VOIDmode,
7076 change_address (operands[0], SImode,
7077 plus_constant (to, i * 4)),
7078 gen_rtx_REG (SImode, regno + i));
7082 [(match_parallel 0 "store_multiple_operation"
7083 [(set (match_operand:SI 1 "indirect_operand" "=Q")
7084 (match_operand:SI 2 "gpc_reg_operand" "r"))
7085 (clobber (match_scratch:SI 3 "=q"))])]
7086 "TARGET_STRING && TARGET_POWER"
7087 "{stsi|stswi} %2,%P1,%O0"
7088 [(set_attr "type" "store")])
7091 [(match_parallel 0 "store_multiple_operation"
7092 [(set (mem:SI (match_operand:SI 1 "register_operand" "b"))
7093 (match_operand:SI 2 "gpc_reg_operand" "r"))
7094 (clobber (match_scratch:SI 3 "X"))])]
7095 "TARGET_STRING && !TARGET_POWER"
7096 "{stsi|stswi} %2,%1,%O0"
7097 [(set_attr "type" "store")])
7100 ;; String/block move insn.
7101 ;; Argument 0 is the destination
7102 ;; Argument 1 is the source
7103 ;; Argument 2 is the length
7104 ;; Argument 3 is the alignment
7106 (define_expand "movstrsi"
7107 [(parallel [(set (match_operand:BLK 0 "" "")
7108 (match_operand:BLK 1 "" ""))
7109 (use (match_operand:SI 2 "" ""))
7110 (use (match_operand:SI 3 "" ""))])]
7114 if (expand_block_move (operands))
7120 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
7121 ;; register allocator doesn't have a clue about allocating 8 word registers
7122 (define_expand "movstrsi_8reg"
7123 [(parallel [(set (match_operand 0 "" "")
7124 (match_operand 1 "" ""))
7125 (use (match_operand 2 "" ""))
7126 (use (match_operand 3 "" ""))
7127 (clobber (reg:SI 5))
7128 (clobber (reg:SI 6))
7129 (clobber (reg:SI 7))
7130 (clobber (reg:SI 8))
7131 (clobber (reg:SI 9))
7132 (clobber (reg:SI 10))
7133 (clobber (reg:SI 11))
7134 (clobber (reg:SI 12))
7135 (clobber (match_scratch:SI 4 ""))])]
7140 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
7141 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
7142 (use (match_operand:SI 2 "immediate_operand" "i"))
7143 (use (match_operand:SI 3 "immediate_operand" "i"))
7144 (clobber (match_operand:SI 4 "register_operand" "=r"))
7145 (clobber (reg:SI 6))
7146 (clobber (reg:SI 7))
7147 (clobber (reg:SI 8))
7148 (clobber (reg:SI 9))
7149 (clobber (reg:SI 10))
7150 (clobber (reg:SI 11))
7151 (clobber (reg:SI 12))
7152 (clobber (match_scratch:SI 5 "=q"))]
7153 "TARGET_STRING && TARGET_POWER
7154 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32) || INTVAL (operands[2]) == 0)
7155 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
7156 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
7157 && REGNO (operands[4]) == 5"
7158 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
7159 [(set_attr "type" "load")
7160 (set_attr "length" "8")])
7163 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
7164 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
7165 (use (match_operand:SI 2 "immediate_operand" "i"))
7166 (use (match_operand:SI 3 "immediate_operand" "i"))
7167 (clobber (match_operand:SI 4 "register_operand" "=r"))
7168 (clobber (reg:SI 6))
7169 (clobber (reg:SI 7))
7170 (clobber (reg:SI 8))
7171 (clobber (reg:SI 9))
7172 (clobber (reg:SI 10))
7173 (clobber (reg:SI 11))
7174 (clobber (reg:SI 12))
7175 (clobber (match_scratch:SI 5 "X"))]
7176 "TARGET_STRING && !TARGET_POWER
7177 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32) || INTVAL (operands[2]) == 0)
7178 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
7179 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
7180 && REGNO (operands[4]) == 5"
7181 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
7182 [(set_attr "type" "load")
7183 (set_attr "length" "8")])
7185 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
7186 ;; register allocator doesn't have a clue about allocating 6 word registers
7187 (define_expand "movstrsi_6reg"
7188 [(parallel [(set (match_operand 0 "" "")
7189 (match_operand 1 "" ""))
7190 (use (match_operand 2 "" ""))
7191 (use (match_operand 3 "" ""))
7192 (clobber (reg:SI 7))
7193 (clobber (reg:SI 8))
7194 (clobber (reg:SI 9))
7195 (clobber (reg:SI 10))
7196 (clobber (reg:SI 11))
7197 (clobber (reg:SI 12))
7198 (clobber (match_scratch:SI 4 ""))])]
7203 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
7204 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
7205 (use (match_operand:SI 2 "immediate_operand" "i"))
7206 (use (match_operand:SI 3 "immediate_operand" "i"))
7207 (clobber (match_operand:SI 4 "register_operand" "=r"))
7208 (clobber (reg:SI 8))
7209 (clobber (reg:SI 9))
7210 (clobber (reg:SI 10))
7211 (clobber (reg:SI 11))
7212 (clobber (reg:SI 12))
7213 (clobber (match_scratch:SI 5 "=q"))]
7214 "TARGET_STRING && TARGET_POWER
7215 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
7216 && (REGNO (operands[0]) < 7 || REGNO (operands[0]) > 12)
7217 && (REGNO (operands[1]) < 7 || REGNO (operands[1]) > 12)
7218 && REGNO (operands[4]) == 7"
7219 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
7220 [(set_attr "type" "load")
7221 (set_attr "length" "8")])
7224 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
7225 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
7226 (use (match_operand:SI 2 "immediate_operand" "i"))
7227 (use (match_operand:SI 3 "immediate_operand" "i"))
7228 (clobber (match_operand:SI 4 "register_operand" "=r"))
7229 (clobber (reg:SI 8))
7230 (clobber (reg:SI 9))
7231 (clobber (reg:SI 10))
7232 (clobber (reg:SI 11))
7233 (clobber (reg:SI 12))
7234 (clobber (match_scratch:SI 5 "X"))]
7235 "TARGET_STRING && !TARGET_POWER
7236 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
7237 && (REGNO (operands[0]) < 7 || REGNO (operands[0]) > 12)
7238 && (REGNO (operands[1]) < 7 || REGNO (operands[1]) > 12)
7239 && REGNO (operands[4]) == 7"
7240 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
7241 [(set_attr "type" "load")
7242 (set_attr "length" "8")])
7244 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill problems
7246 (define_expand "movstrsi_4reg"
7247 [(parallel [(set (match_operand 0 "" "")
7248 (match_operand 1 "" ""))
7249 (use (match_operand 2 "" ""))
7250 (use (match_operand 3 "" ""))
7251 (clobber (reg:SI 9))
7252 (clobber (reg:SI 10))
7253 (clobber (reg:SI 11))
7254 (clobber (reg:SI 12))
7255 (clobber (match_scratch:SI 4 ""))])]
7260 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
7261 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
7262 (use (match_operand:SI 2 "immediate_operand" "i"))
7263 (use (match_operand:SI 3 "immediate_operand" "i"))
7264 (clobber (match_operand:SI 4 "register_operand" "=r"))
7265 (clobber (reg:SI 10))
7266 (clobber (reg:SI 11))
7267 (clobber (reg:SI 12))
7268 (clobber (match_scratch:SI 5 "=q"))]
7269 "TARGET_STRING && TARGET_POWER
7270 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
7271 && (REGNO (operands[0]) < 9 || REGNO (operands[0]) > 12)
7272 && (REGNO (operands[1]) < 9 || REGNO (operands[1]) > 12)
7273 && REGNO (operands[4]) == 9"
7274 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
7275 [(set_attr "type" "load")
7276 (set_attr "length" "8")])
7279 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
7280 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
7281 (use (match_operand:SI 2 "immediate_operand" "i"))
7282 (use (match_operand:SI 3 "immediate_operand" "i"))
7283 (clobber (match_operand:SI 4 "register_operand" "=r"))
7284 (clobber (reg:SI 10))
7285 (clobber (reg:SI 11))
7286 (clobber (reg:SI 12))
7287 (clobber (match_scratch:SI 5 "X"))]
7288 "TARGET_STRING && !TARGET_POWER
7289 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
7290 && (REGNO (operands[0]) < 9 || REGNO (operands[0]) > 12)
7291 && (REGNO (operands[1]) < 9 || REGNO (operands[1]) > 12)
7292 && REGNO (operands[4]) == 9"
7293 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
7294 [(set_attr "type" "load")
7295 (set_attr "length" "8")])
7297 ;; Move up to 8 bytes at a time.
7298 (define_expand "movstrsi_2reg"
7299 [(parallel [(set (match_operand 0 "" "")
7300 (match_operand 1 "" ""))
7301 (use (match_operand 2 "" ""))
7302 (use (match_operand 3 "" ""))
7303 (clobber (match_scratch:DI 4 ""))
7304 (clobber (match_scratch:SI 5 ""))])]
7305 "TARGET_STRING && !TARGET_64BIT"
7309 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
7310 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
7311 (use (match_operand:SI 2 "immediate_operand" "i"))
7312 (use (match_operand:SI 3 "immediate_operand" "i"))
7313 (clobber (match_scratch:DI 4 "=&r"))
7314 (clobber (match_scratch:SI 5 "=q"))]
7315 "TARGET_STRING && TARGET_POWER && !TARGET_64BIT
7316 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
7317 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
7318 [(set_attr "type" "load")
7319 (set_attr "length" "8")])
7322 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
7323 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
7324 (use (match_operand:SI 2 "immediate_operand" "i"))
7325 (use (match_operand:SI 3 "immediate_operand" "i"))
7326 (clobber (match_scratch:DI 4 "=&r"))
7327 (clobber (match_scratch:SI 5 "X"))]
7328 "TARGET_STRING && !TARGET_POWER && !TARGET_64BIT
7329 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
7330 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
7331 [(set_attr "type" "load")
7332 (set_attr "length" "8")])
7334 ;; Move up to 4 bytes at a time.
7335 (define_expand "movstrsi_1reg"
7336 [(parallel [(set (match_operand 0 "" "")
7337 (match_operand 1 "" ""))
7338 (use (match_operand 2 "" ""))
7339 (use (match_operand 3 "" ""))
7340 (clobber (match_scratch:SI 4 ""))
7341 (clobber (match_scratch:SI 5 ""))])]
7346 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
7347 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
7348 (use (match_operand:SI 2 "immediate_operand" "i"))
7349 (use (match_operand:SI 3 "immediate_operand" "i"))
7350 (clobber (match_scratch:SI 4 "=&r"))
7351 (clobber (match_scratch:SI 5 "=q"))]
7352 "TARGET_STRING && TARGET_POWER
7353 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
7354 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
7355 [(set_attr "type" "load")
7356 (set_attr "length" "8")])
7359 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
7360 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
7361 (use (match_operand:SI 2 "immediate_operand" "i"))
7362 (use (match_operand:SI 3 "immediate_operand" "i"))
7363 (clobber (match_scratch:SI 4 "=&r"))
7364 (clobber (match_scratch:SI 5 "X"))]
7365 "TARGET_STRING && !TARGET_POWER
7366 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
7367 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
7368 [(set_attr "type" "load")
7369 (set_attr "length" "8")])
7372 ;; Define insns that do load or store with update. Some of these we can
7373 ;; get by using pre-decrement or pre-increment, but the hardware can also
7374 ;; do cases where the increment is not the size of the object.
7376 ;; In all these cases, we use operands 0 and 1 for the register being
7377 ;; incremented because those are the operands that local-alloc will
7378 ;; tie and these are the pair most likely to be tieable (and the ones
7379 ;; that will benefit the most).
7381 (define_insn "*movdi_update1"
7382 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
7383 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
7384 (match_operand:DI 2 "reg_or_short_operand" "r,I"))))
7385 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
7386 (plus:DI (match_dup 1) (match_dup 2)))]
7387 "TARGET_POWERPC64 && TARGET_UPDATE"
7391 [(set_attr "type" "load")])
7393 (define_insn "*movdi_update2"
7394 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
7396 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
7397 (match_operand:DI 2 "gpc_reg_operand" "r")))))
7398 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
7399 (plus:DI (match_dup 1) (match_dup 2)))]
7402 [(set_attr "type" "load")])
7404 (define_insn "movdi_update"
7405 [(set (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
7406 (match_operand:DI 2 "reg_or_short_operand" "r,I")))
7407 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
7408 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
7409 (plus:DI (match_dup 1) (match_dup 2)))]
7410 "TARGET_POWERPC64 && TARGET_UPDATE"
7414 [(set_attr "type" "store")])
7416 (define_insn "*movsi_update1"
7417 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
7418 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
7419 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
7420 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
7421 (plus:SI (match_dup 1) (match_dup 2)))]
7424 {lux|lwzux} %3,%0,%2
7425 {lu|lwzu} %3,%2(%0)"
7426 [(set_attr "type" "load")])
7428 (define_insn "movsi_update"
7429 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
7430 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
7431 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
7432 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
7433 (plus:SI (match_dup 1) (match_dup 2)))]
7436 {stux|stwux} %3,%0,%2
7437 {stu|stwu} %3,%2(%0)"
7438 [(set_attr "type" "store")])
7440 (define_insn "*movhi_update"
7441 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
7442 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
7443 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
7444 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
7445 (plus:SI (match_dup 1) (match_dup 2)))]
7450 [(set_attr "type" "load")])
7452 (define_insn "*movhi_update2"
7453 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
7455 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
7456 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
7457 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
7458 (plus:SI (match_dup 1) (match_dup 2)))]
7463 [(set_attr "type" "load")])
7465 (define_insn "*movhi_update3"
7466 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
7468 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
7469 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
7470 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
7471 (plus:SI (match_dup 1) (match_dup 2)))]
7476 [(set_attr "type" "load")])
7478 (define_insn "*movhi_update4"
7479 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
7480 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
7481 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
7482 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
7483 (plus:SI (match_dup 1) (match_dup 2)))]
7488 [(set_attr "type" "store")])
7490 (define_insn "*movqi_update1"
7491 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
7492 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
7493 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
7494 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
7495 (plus:SI (match_dup 1) (match_dup 2)))]
7500 [(set_attr "type" "load")])
7502 (define_insn "*movqi_update2"
7503 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
7505 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
7506 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
7507 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
7508 (plus:SI (match_dup 1) (match_dup 2)))]
7513 [(set_attr "type" "load")])
7515 (define_insn "*movqi_update3"
7516 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
7517 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
7518 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
7519 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
7520 (plus:SI (match_dup 1) (match_dup 2)))]
7525 [(set_attr "type" "store")])
7527 (define_insn "*movsf_update1"
7528 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
7529 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
7530 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
7531 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
7532 (plus:SI (match_dup 1) (match_dup 2)))]
7533 "TARGET_HARD_FLOAT && TARGET_UPDATE"
7537 [(set_attr "type" "fpload")])
7539 (define_insn "*movsf_update2"
7540 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
7541 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
7542 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
7543 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
7544 (plus:SI (match_dup 1) (match_dup 2)))]
7545 "TARGET_HARD_FLOAT && TARGET_UPDATE"
7549 [(set_attr "type" "fpstore")])
7551 (define_insn "*movsf_update3"
7552 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
7553 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
7554 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
7555 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
7556 (plus:SI (match_dup 1) (match_dup 2)))]
7557 "TARGET_SOFT_FLOAT && TARGET_UPDATE"
7559 {lux|lwzux} %3,%0,%2
7560 {lu|lwzu} %3,%2(%0)"
7561 [(set_attr "type" "load")])
7563 (define_insn "*movsf_update4"
7564 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
7565 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
7566 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
7567 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
7568 (plus:SI (match_dup 1) (match_dup 2)))]
7569 "TARGET_SOFT_FLOAT && TARGET_UPDATE"
7571 {stux|stwux} %3,%0,%2
7572 {stu|stwu} %3,%2(%0)"
7573 [(set_attr "type" "store")])
7575 (define_insn "*movdf_update1"
7576 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
7577 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
7578 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
7579 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
7580 (plus:SI (match_dup 1) (match_dup 2)))]
7581 "TARGET_HARD_FLOAT && TARGET_UPDATE"
7585 [(set_attr "type" "fpload")])
7587 (define_insn "*movdf_update2"
7588 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
7589 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
7590 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
7591 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
7592 (plus:SI (match_dup 1) (match_dup 2)))]
7593 "TARGET_HARD_FLOAT && TARGET_UPDATE"
7597 [(set_attr "type" "fpstore")])
7599 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
7602 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
7603 (match_operand:DF 1 "memory_operand" ""))
7604 (set (match_operand:DF 2 "gpc_reg_operand" "=f")
7605 (match_operand:DF 3 "memory_operand" ""))]
7607 && TARGET_HARD_FLOAT
7608 && registers_ok_for_quad_peep (operands[0], operands[2])
7609 && ! MEM_VOLATILE_P (operands[1]) && ! MEM_VOLATILE_P (operands[3])
7610 && addrs_ok_for_quad_peep (XEXP (operands[1], 0), XEXP (operands[3], 0))"
7614 [(set (match_operand:DF 0 "memory_operand" "")
7615 (match_operand:DF 1 "gpc_reg_operand" "f"))
7616 (set (match_operand:DF 2 "memory_operand" "")
7617 (match_operand:DF 3 "gpc_reg_operand" "f"))]
7619 && TARGET_HARD_FLOAT
7620 && registers_ok_for_quad_peep (operands[1], operands[3])
7621 && ! MEM_VOLATILE_P (operands[0]) && ! MEM_VOLATILE_P (operands[2])
7622 && addrs_ok_for_quad_peep (XEXP (operands[0], 0), XEXP (operands[2], 0))"
7625 ;; Next come insns related to the calling sequence.
7627 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
7628 ;; We move the back-chain and decrement the stack pointer.
7630 (define_expand "allocate_stack"
7631 [(set (match_operand 0 "register_operand" "=r")
7632 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
7634 (minus (reg 1) (match_dup 1)))]
7637 { rtx chain = gen_reg_rtx (Pmode);
7638 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
7641 emit_move_insn (chain, stack_bot);
7643 /* Under Windows NT, we need to add stack probes for large/variable
7644 allocations, so do it via a call to the external function alloca
7645 instead of doing it inline. */
7646 if (DEFAULT_ABI == ABI_NT
7647 && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) > 4096))
7649 rtx tmp = gen_reg_rtx (Pmode);
7650 emit_library_call_value (gen_rtx_SYMBOL_REF (Pmode, \"__allocate_stack\"),
7651 tmp, 0, Pmode, 1, operands[1], Pmode);
7652 emit_insn (gen_set_sp (tmp));
7653 emit_move_insn (operands[0], tmp);
7657 if (GET_CODE (operands[1]) != CONST_INT
7658 || INTVAL (operands[1]) < -32767
7659 || INTVAL (operands[1]) > 32768)
7661 neg_op0 = gen_reg_rtx (Pmode);
7663 emit_insn (gen_negsi2 (neg_op0, operands[1]));
7665 emit_insn (gen_negdi2 (neg_op0, operands[1]));
7668 neg_op0 = GEN_INT (- INTVAL (operands[1]));
7671 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_update))
7672 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
7676 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
7677 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
7678 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
7681 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
7685 ;; Marker to indicate that the stack pointer was changed under NT in
7686 ;; ways not known to the compiler
7688 (define_insn "set_sp"
7690 (unspec [(match_operand:SI 0 "register_operand" "r")] 7))]
7693 [(set_attr "length" "0")])
7695 ;; These patterns say how to save and restore the stack pointer. We need not
7696 ;; save the stack pointer at function level since we are careful to
7697 ;; preserve the backchain. At block level, we have to restore the backchain
7698 ;; when we restore the stack pointer.
7700 ;; For nonlocal gotos, we must save both the stack pointer and its
7701 ;; backchain and restore both. Note that in the nonlocal case, the
7702 ;; save area is a memory location.
7704 (define_expand "save_stack_function"
7705 [(match_operand 0 "any_operand" "")
7706 (match_operand 1 "any_operand" "")]
7710 (define_expand "restore_stack_function"
7711 [(match_operand 0 "any_operand" "")
7712 (match_operand 1 "any_operand" "")]
7716 (define_expand "restore_stack_block"
7717 [(use (match_operand 0 "register_operand" ""))
7718 (set (match_dup 2) (match_dup 3))
7719 (set (match_dup 0) (match_operand 1 "register_operand" ""))
7720 (set (match_dup 3) (match_dup 2))]
7724 operands[2] = gen_reg_rtx (Pmode);
7725 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
7728 (define_expand "save_stack_nonlocal"
7729 [(match_operand 0 "memory_operand" "")
7730 (match_operand 1 "register_operand" "")]
7734 rtx temp = gen_reg_rtx (Pmode);
7736 /* Copy the backchain to the first word, sp to the second. */
7737 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
7738 emit_move_insn (operand_subword (operands[0], 0, 0, (TARGET_32BIT ? DImode : TImode)),
7740 emit_move_insn (operand_subword (operands[0], 1, 0, (TARGET_32BIT ? DImode : TImode)),
7745 (define_expand "restore_stack_nonlocal"
7746 [(match_operand 0 "register_operand" "")
7747 (match_operand 1 "memory_operand" "")]
7751 rtx temp = gen_reg_rtx (Pmode);
7753 /* Restore the backchain from the first word, sp from the second. */
7754 emit_move_insn (temp,
7755 operand_subword (operands[1], 0, 0, (TARGET_32BIT ? DImode : TImode)));
7756 emit_move_insn (operands[0],
7757 operand_subword (operands[1], 1, 0, (TARGET_32BIT ? DImode : TImode)));
7758 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
7762 ;; If we have -mminimal-toc, we need to reload r30 after a nonlocal goto.
7764 (define_insn "nonlocal_goto_receiver"
7765 [(unspec_volatile [(const_int 0)] 1)]
7766 "TARGET_TOC && TARGET_MINIMAL_TOC"
7769 rs6000_output_load_toc_table (asm_out_file, 30);
7772 [(set_attr "type" "load")])
7774 ;; A function pointer under AIX is a pointer to a data area whose first word
7775 ;; contains the actual address of the function, whose second word contains a
7776 ;; pointer to its TOC, and whose third word contains a value to place in the
7777 ;; static chain register (r11). Note that if we load the static chain, our
7778 ;; "trampoline" need not have any executable code.
7780 ;; operands[0] is a register pointing to the 3 word descriptor (aka, the function address)
7781 ;; operands[1] is the stack size to clean up
7782 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument (must be 0 for AIX)
7783 ;; operands[3] is location to store the TOC
7784 ;; operands[4] is the TOC register
7785 ;; operands[5] is the static chain register
7787 ;; We do not break this into separate insns, so that the scheduler will not try
7788 ;; to move the load of the new TOC before any loads from the TOC.
7790 (define_insn "call_indirect_aix32"
7791 [(call (mem:SI (match_operand:SI 0 "register_operand" "b"))
7792 (match_operand 1 "const_int_operand" "n"))
7793 (use (match_operand 2 "const_int_operand" "n"))
7794 (use (match_operand 3 "offsettable_mem_operand" "o"))
7795 (use (match_operand 4 "register_operand" "r"))
7796 (clobber (match_operand 5 "register_operand" "=r"))
7797 (clobber (match_scratch:SI 6 "=&r"))
7798 (clobber (match_scratch:SI 7 "=l"))]
7799 "DEFAULT_ABI == ABI_AIX
7800 && (INTVAL (operands[2]) == CALL_NORMAL || (INTVAL (operands[2]) & CALL_LONG) != 0)"
7801 "{st|stw} %4,%3\;{l|lwz} %6,0(%0)\;{l|lwz} %4,4(%0)\;mt%7 %6\;{l|lwz} %5,8(%0)\;{brl|blrl}\;{l|lwz} %4,%3"
7802 [(set_attr "type" "load")
7803 (set_attr "length" "28")])
7805 (define_insn "call_indirect_aix64"
7806 [(call (mem:SI (match_operand:DI 0 "register_operand" "b"))
7807 (match_operand 1 "const_int_operand" "n"))
7808 (use (match_operand 2 "const_int_operand" "n"))
7809 (use (match_operand 3 "offsettable_mem_operand" "o"))
7810 (use (match_operand 4 "register_operand" "r"))
7811 (clobber (match_operand 5 "register_operand" "=r"))
7812 (clobber (match_scratch:SI 6 "=&r"))
7813 (clobber (match_scratch:SI 7 "=l"))]
7814 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX
7815 && (INTVAL (operands[2]) == CALL_NORMAL || (INTVAL (operands[2]) & CALL_LONG) != 0)"
7816 "std %4,%3\;ld %6,0(%0)\;ld %4,8(%0)\;mt%7 %6\;ld %5,16(%0)\;blrl\;ld %4,%3"
7817 [(set_attr "type" "load")
7818 (set_attr "length" "28")])
7820 (define_insn "call_value_indirect_aix32"
7821 [(set (match_operand 0 "register_operand" "fg")
7822 (call (mem:SI (match_operand:SI 1 "register_operand" "b"))
7823 (match_operand 2 "const_int_operand" "n")))
7824 (use (match_operand 3 "const_int_operand" "n"))
7825 (use (match_operand 4 "offsettable_mem_operand" "o"))
7826 (use (match_operand 5 "register_operand" "r"))
7827 (clobber (match_operand 6 "register_operand" "=r"))
7828 (clobber (match_scratch:SI 7 "=&r"))
7829 (clobber (match_scratch:SI 8 "=l"))]
7830 "DEFAULT_ABI == ABI_AIX
7831 && (INTVAL (operands[3]) == CALL_NORMAL || (INTVAL (operands[3]) & CALL_LONG) != 0)"
7832 "{st|stw} %5,%4\;{l|lwz} %7,0(%1)\;{l|lwz} %5,4(%1)\;mt%8 %7\;{l|lwz} %6,8(%1)\;{brl|blrl}\;{l|lwz} %5,%4"
7833 [(set_attr "type" "load")
7834 (set_attr "length" "28")])
7836 (define_insn "call_value_indirect_aix64"
7837 [(set (match_operand 0 "register_operand" "fg")
7838 (call (mem:SI (match_operand:DI 1 "register_operand" "b"))
7839 (match_operand 2 "const_int_operand" "n")))
7840 (use (match_operand 3 "const_int_operand" "n"))
7841 (use (match_operand 4 "offsettable_mem_operand" "o"))
7842 (use (match_operand 5 "register_operand" "r"))
7843 (clobber (match_operand 6 "register_operand" "=r"))
7844 (clobber (match_scratch:SI 7 "=&r"))
7845 (clobber (match_scratch:SI 8 "=l"))]
7846 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX
7847 && (INTVAL (operands[3]) == CALL_NORMAL || (INTVAL (operands[3]) & CALL_LONG) != 0)"
7848 "std %5,%4\;ld %7,0(%1)\;ld %5,8(%1)\;mt%8 %7\;ld %6,16(%1)\;blrl\;ld %5,%4"
7849 [(set_attr "type" "load")
7850 (set_attr "length" "28")])
7852 ;; A function pointer undef NT is a pointer to a data area whose first word
7853 ;; contains the actual address of the function, whose second word contains a
7854 ;; pointer to its TOC. The static chain is not stored under NT, which means
7855 ;; that we need a trampoline.
7857 ;; operands[0] is an SImode pseudo in which we place the address of the function.
7858 ;; operands[1] is the stack size to clean up
7859 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument (must be 0 for NT)
7860 ;; operands[3] is location to store the TOC
7861 ;; operands[4] is the TOC register
7863 ;; We do not break this into separate insns, so that the scheduler will not try
7864 ;; to move the load of the new TOC before any loads from the TOC.
7866 (define_insn "call_indirect_nt"
7867 [(call (mem:SI (match_operand:SI 0 "register_operand" "b"))
7868 (match_operand 1 "const_int_operand" "n"))
7869 (use (match_operand 2 "const_int_operand" "n"))
7870 (use (match_operand 3 "offsettable_mem_operand" "o"))
7871 (use (match_operand 4 "register_operand" "r"))
7872 (clobber (match_scratch:SI 5 "=&r"))
7873 (clobber (match_scratch:SI 6 "=l"))]
7874 "DEFAULT_ABI == ABI_NT
7875 && (INTVAL (operands[2]) == CALL_NORMAL || (INTVAL (operands[2]) & CALL_LONG) != 0)"
7876 "{st|stw} %4,%a3\;{l|lwz} %5,0(%0)\;{l|lwz} %4,4(%0)\;mt%6 %5\;{brl|blrl}\;{l|lwz} %4,%a3"
7877 [(set_attr "type" "load")
7878 (set_attr "length" "24")])
7880 (define_insn "call_value_indirect_nt"
7881 [(set (match_operand 0 "register_operand" "fg")
7882 (call (mem:SI (match_operand:SI 1 "register_operand" "b"))
7883 (match_operand 2 "const_int_operand" "n")))
7884 (use (match_operand 3 "const_int_operand" "n"))
7885 (use (match_operand 4 "offsettable_mem_operand" "o"))
7886 (use (match_operand 5 "register_operand" "r"))
7887 (clobber (match_scratch:SI 6 "=&r"))
7888 (clobber (match_scratch:SI 7 "=l"))]
7889 "DEFAULT_ABI == ABI_NT
7890 && (INTVAL (operands[3]) == CALL_NORMAL || (INTVAL (operands[3]) & CALL_LONG) != 0)"
7891 "{st|stw} %5,%a4\;{l|lwz} %6,0(%1)\;{l|lwz} %5,4(%1)\;mt%7 %6\;{brl|blrl}\;{l|lwz} %5,%a4"
7892 [(set_attr "type" "load")
7893 (set_attr "length" "24")])
7895 ;; A function pointer under System V is just a normal pointer
7896 ;; operands[0] is the function pointer
7897 ;; operands[1] is the stack size to clean up
7898 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument which indicates how to set cr1
7900 (define_insn "call_indirect_sysv"
7901 [(call (mem:SI (match_operand:SI 0 "register_operand" "l,l"))
7902 (match_operand 1 "const_int_operand" "n,n"))
7903 (use (match_operand 2 "const_int_operand" "O,n"))
7904 (clobber (match_scratch:SI 3 "=l,l"))]
7905 "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS || DEFAULT_ABI == ABI_AIX_NODESC"
7908 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
7909 output_asm_insn (\"crxor 6,6,6\", operands);
7911 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
7912 output_asm_insn (\"creqv 6,6,6\", operands);
7914 return \"{brl|blrl}\";
7916 [(set_attr "type" "jmpreg")
7917 (set_attr "length" "4,8")])
7919 (define_insn "call_value_indirect_sysv"
7920 [(set (match_operand 0 "register_operand" "=fg,fg")
7921 (call (mem:SI (match_operand:SI 1 "register_operand" "l,l"))
7922 (match_operand 2 "const_int_operand" "n,n")))
7923 (use (match_operand 3 "const_int_operand" "O,n"))
7924 (clobber (match_scratch:SI 4 "=l,l"))]
7925 "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS || DEFAULT_ABI == ABI_AIX_NODESC"
7928 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
7929 output_asm_insn (\"crxor 6,6,6\", operands);
7931 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
7932 output_asm_insn (\"creqv 6,6,6\", operands);
7934 return \"{brl|blrl}\";
7936 [(set_attr "type" "jmpreg")
7937 (set_attr "length" "4,8")])
7939 ;; Now the definitions for the call and call_value insns
7940 (define_expand "call"
7941 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
7942 (match_operand 1 "" ""))
7943 (use (match_operand 2 "" ""))
7944 (clobber (scratch:SI))])]
7948 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
7951 operands[0] = XEXP (operands[0], 0);
7953 /* Convert NT DLL imports into an indirect call. */
7954 if (GET_CODE (operands[0]) == SYMBOL_REF
7955 && (INTVAL (operands[2]) & CALL_NT_DLLIMPORT) != 0)
7957 operands[0] = rs6000_dll_import_ref (operands[0]);
7958 operands[2] = GEN_INT ((int)CALL_NORMAL);
7961 if (GET_CODE (operands[0]) != SYMBOL_REF
7962 || (INTVAL (operands[2]) & CALL_LONG) != 0)
7964 if (INTVAL (operands[2]) & CALL_LONG)
7965 operands[0] = rs6000_longcall_ref (operands[0]);
7967 if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_SOLARIS)
7968 emit_call_insn (gen_call_indirect_sysv (force_reg (Pmode, operands[0]),
7969 operands[1], operands[2]));
7972 rtx toc_reg = gen_rtx_REG (Pmode, 2);
7973 rtx toc_addr = RS6000_SAVE_TOC;
7975 if (DEFAULT_ABI == ABI_AIX)
7977 /* AIX function pointers are really pointers to a three word area */
7978 rtx static_chain = gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM);
7979 emit_call_insn (TARGET_32BIT
7980 ? gen_call_indirect_aix32 (force_reg (Pmode, operands[0]),
7981 operands[1], operands[2],
7982 toc_addr, toc_reg, static_chain)
7983 : gen_call_indirect_aix64 (force_reg (Pmode, operands[0]),
7984 operands[1], operands[2],
7985 toc_addr, toc_reg, static_chain));
7987 else if (DEFAULT_ABI == ABI_NT)
7989 /* NT function pointers are really pointers to a two word area */
7990 emit_call_insn (gen_call_indirect_nt (force_reg (Pmode, operands[0]),
7991 operands[1], operands[2],
7992 toc_addr, toc_reg));
8001 (define_expand "call_value"
8002 [(parallel [(set (match_operand 0 "" "")
8003 (call (mem:SI (match_operand 1 "address_operand" ""))
8004 (match_operand 2 "" "")))
8005 (use (match_operand 3 "" ""))
8006 (clobber (scratch:SI))])]
8010 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
8013 operands[1] = XEXP (operands[1], 0);
8015 /* Convert NT DLL imports into an indirect call. */
8016 if (GET_CODE (operands[1]) == SYMBOL_REF
8017 && (INTVAL (operands[3]) & CALL_NT_DLLIMPORT) != 0)
8019 operands[1] = rs6000_dll_import_ref (operands[1]);
8020 operands[3] = GEN_INT ((int)CALL_NORMAL);
8023 if (GET_CODE (operands[1]) != SYMBOL_REF
8024 || (INTVAL (operands[3]) & CALL_LONG) != 0)
8026 if (INTVAL (operands[3]) & CALL_LONG)
8027 operands[1] = rs6000_longcall_ref (operands[1]);
8029 if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_SOLARIS)
8030 emit_call_insn (gen_call_value_indirect_sysv (operands[0], operands[1],
8031 operands[2], operands[3]));
8034 rtx toc_reg = gen_rtx_REG (Pmode, 2);
8035 rtx toc_addr = RS6000_SAVE_TOC;
8037 if (DEFAULT_ABI == ABI_AIX)
8039 /* AIX function pointers are really pointers to a three word area */
8040 rtx static_chain = gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM);
8041 emit_call_insn (TARGET_32BIT
8042 ? gen_call_value_indirect_aix32 (operands[0],
8043 force_reg (Pmode, operands[1]),
8044 operands[2], operands[3],
8045 toc_addr, toc_reg, static_chain)
8046 : gen_call_value_indirect_aix64 (operands[0],
8047 force_reg (Pmode, operands[1]),
8048 operands[2], operands[3],
8049 toc_addr, toc_reg, static_chain));
8051 else if (DEFAULT_ABI == ABI_NT)
8053 /* NT function pointers are really pointers to a two word area */
8054 emit_call_insn (gen_call_value_indirect_nt (operands[0],
8055 force_reg (Pmode, operands[1]),
8056 operands[2], operands[3],
8057 toc_addr, toc_reg));
8066 ;; Call to function in current module. No TOC pointer reload needed.
8067 ;; Operand2 is non-zero if we are using the V.4 calling sequence and
8068 ;; either the function was not prototyped, or it was prototyped as a
8069 ;; variable argument function. It is > 0 if FP registers were passed
8070 ;; and < 0 if they were not.
8072 (define_insn "*call_local32"
8073 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
8074 (match_operand 1 "" "g,g"))
8075 (use (match_operand:SI 2 "immediate_operand" "O,n"))
8076 (clobber (match_scratch:SI 3 "=l,l"))]
8077 "(INTVAL (operands[2]) & CALL_LONG) == 0"
8080 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
8081 output_asm_insn (\"crxor 6,6,6\", operands);
8083 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
8084 output_asm_insn (\"creqv 6,6,6\", operands);
8086 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
8088 [(set_attr "type" "branch")
8089 (set_attr "length" "4,8")])
8091 (define_insn "*call_local64"
8092 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
8093 (match_operand 1 "" "g,g"))
8094 (use (match_operand:SI 2 "immediate_operand" "O,n"))
8095 (clobber (match_scratch:SI 3 "=l,l"))]
8096 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
8099 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
8100 output_asm_insn (\"crxor 6,6,6\", operands);
8102 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
8103 output_asm_insn (\"creqv 6,6,6\", operands);
8105 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
8107 [(set_attr "type" "branch")
8108 (set_attr "length" "4,8")])
8110 (define_insn "*ret_call_local32"
8111 [(set (match_operand 0 "" "=fg,fg")
8112 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
8113 (match_operand 2 "" "g,g")))
8114 (use (match_operand:SI 3 "immediate_operand" "O,n"))
8115 (clobber (match_scratch:SI 4 "=l,l"))]
8116 "(INTVAL (operands[3]) & CALL_LONG) == 0"
8119 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
8120 output_asm_insn (\"crxor 6,6,6\", operands);
8122 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
8123 output_asm_insn (\"creqv 6,6,6\", operands);
8125 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
8127 [(set_attr "type" "branch")
8128 (set_attr "length" "4,8")])
8131 (define_insn "*ret_call_local64"
8132 [(set (match_operand 0 "" "=fg,fg")
8133 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
8134 (match_operand 2 "" "g,g")))
8135 (use (match_operand:SI 3 "immediate_operand" "O,n"))
8136 (clobber (match_scratch:SI 4 "=l,l"))]
8137 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
8140 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
8141 output_asm_insn (\"crxor 6,6,6\", operands);
8143 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
8144 output_asm_insn (\"creqv 6,6,6\", operands);
8146 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
8148 [(set_attr "type" "branch")
8149 (set_attr "length" "4,8")])
8151 ;; Call to function which may be in another module. Restore the TOC
8152 ;; pointer (r2) after the call unless this is System V.
8153 ;; Operand2 is non-zero if we are using the V.4 calling sequence and
8154 ;; either the function was not prototyped, or it was prototyped as a
8155 ;; variable argument function. It is > 0 if FP registers were passed
8156 ;; and < 0 if they were not.
8158 (define_insn "*call_nonlocal_aix32"
8159 [(call (mem:SI (match_operand:SI 0 "call_operand" "s,s"))
8160 (match_operand 1 "" "fg,fg"))
8161 (use (match_operand:SI 2 "immediate_operand" "O,n"))
8162 (clobber (match_scratch:SI 3 "=l,l"))]
8163 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)
8164 && (INTVAL (operands[2]) & CALL_LONG) == 0"
8167 /* Indirect calls should go through call_indirect */
8168 if (GET_CODE (operands[0]) == REG)
8171 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
8172 output_asm_insn (\"crxor 6,6,6\", operands);
8174 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
8175 output_asm_insn (\"creqv 6,6,6\", operands);
8177 return (TARGET_WINDOWS_NT) ? \"bl %z0\;.znop %z0\" : \"bl %z0\;%.\";
8179 [(set_attr "type" "branch")
8180 (set_attr "length" "8,12")])
8182 (define_insn "*call_nonlocal_aix64"
8183 [(call (mem:SI (match_operand:DI 0 "call_operand" "s,s"))
8184 (match_operand 1 "" "fg,fg"))
8185 (use (match_operand:SI 2 "immediate_operand" "O,n"))
8186 (clobber (match_scratch:SI 3 "=l,l"))]
8187 "TARGET_64BIT && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)
8188 && (INTVAL (operands[2]) & CALL_LONG) == 0"
8191 /* Indirect calls should go through call_indirect */
8192 if (GET_CODE (operands[0]) == REG)
8195 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
8196 output_asm_insn (\"crxor 6,6,6\", operands);
8198 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
8199 output_asm_insn (\"creqv 6,6,6\", operands);
8201 return (TARGET_WINDOWS_NT) ? \"bl %z0\;.znop %z0\" : \"bl %z0\;%.\";
8203 [(set_attr "type" "branch")
8204 (set_attr "length" "8,12")])
8206 (define_insn "*call_nonlocal_sysv"
8207 [(call (mem:SI (match_operand:SI 0 "call_operand" "s,s"))
8208 (match_operand 1 "" "fg,fg"))
8209 (use (match_operand:SI 2 "immediate_operand" "O,n"))
8210 (clobber (match_scratch:SI 3 "=l,l"))]
8211 "(DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
8212 && (INTVAL (operands[2]) & CALL_LONG) == 0"
8215 /* Indirect calls should go through call_indirect */
8216 if (GET_CODE (operands[0]) == REG)
8219 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
8220 output_asm_insn (\"crxor 6,6,6\", operands);
8222 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
8223 output_asm_insn (\"creqv 6,6,6\", operands);
8225 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@plt\" : \"bl %z0\";
8227 [(set_attr "type" "branch")
8228 (set_attr "length" "4,8")])
8230 (define_insn "*ret_call_nonlocal_aix32"
8231 [(set (match_operand 0 "" "=fg,fg")
8232 (call (mem:SI (match_operand:SI 1 "call_operand" "s,s"))
8233 (match_operand 2 "" "fg,fg")))
8234 (use (match_operand:SI 3 "immediate_operand" "O,n"))
8235 (clobber (match_scratch:SI 4 "=l,l"))]
8236 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)
8237 && (INTVAL (operands[3]) & CALL_LONG) == 0"
8240 /* This should be handled by call_value_indirect */
8241 if (GET_CODE (operands[1]) == REG)
8244 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
8245 output_asm_insn (\"crxor 6,6,6\", operands);
8247 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
8248 output_asm_insn (\"creqv 6,6,6\", operands);
8250 return (TARGET_WINDOWS_NT) ? \"bl %z1\;.znop %z1\" : \"bl %z1\;%.\";
8252 [(set_attr "type" "branch")
8253 (set_attr "length" "8,12")])
8255 (define_insn "*ret_call_nonlocal_aix64"
8256 [(set (match_operand 0 "" "=fg,fg")
8257 (call (mem:SI (match_operand:DI 1 "call_operand" "s,s"))
8258 (match_operand 2 "" "fg,fg")))
8259 (use (match_operand:SI 3 "immediate_operand" "O,n"))
8260 (clobber (match_scratch:SI 4 "=l,l"))]
8261 "TARGET_64BIT && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)
8262 && (INTVAL (operands[3]) & CALL_LONG) == 0"
8265 /* This should be handled by call_value_indirect */
8266 if (GET_CODE (operands[1]) == REG)
8269 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
8270 output_asm_insn (\"crxor 6,6,6\", operands);
8272 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
8273 output_asm_insn (\"creqv 6,6,6\", operands);
8275 return (TARGET_WINDOWS_NT) ? \"bl %z1\;.znop %z1\" : \"bl %z1\;%.\";
8277 [(set_attr "type" "branch")
8278 (set_attr "length" "8,12")])
8280 (define_insn "*ret_call_nonlocal_sysv"
8281 [(set (match_operand 0 "" "=fg,fg")
8282 (call (mem:SI (match_operand:SI 1 "call_operand" "s,s"))
8283 (match_operand 2 "" "fg,fg")))
8284 (use (match_operand:SI 3 "immediate_operand" "O,n"))
8285 (clobber (match_scratch:SI 4 "=l,l"))]
8286 "(DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
8287 && (INTVAL (operands[3]) & CALL_LONG) == 0"
8290 /* This should be handled by call_value_indirect */
8291 if (GET_CODE (operands[1]) == REG)
8294 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
8295 output_asm_insn (\"crxor 6,6,6\", operands);
8297 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
8298 output_asm_insn (\"creqv 6,6,6\", operands);
8300 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@plt\" : \"bl %z1\";
8302 [(set_attr "type" "branch")
8303 (set_attr "length" "4,8")])
8305 ;; Call subroutine returning any type.
8306 (define_expand "untyped_call"
8307 [(parallel [(call (match_operand 0 "" "")
8309 (match_operand 1 "" "")
8310 (match_operand 2 "" "")])]
8316 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx, const0_rtx));
8318 for (i = 0; i < XVECLEN (operands[2], 0); i++)
8320 rtx set = XVECEXP (operands[2], 0, i);
8321 emit_move_insn (SET_DEST (set), SET_SRC (set));
8324 /* The optimizer does not know that the call sets the function value
8325 registers we stored in the result block. We avoid problems by
8326 claiming that all hard registers are used and clobbered at this
8328 emit_insn (gen_blockage ());
8333 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
8334 ;; all of memory. This blocks insns from being moved across this point.
8336 (define_insn "blockage"
8337 [(unspec_volatile [(const_int 0)] 0)]
8341 ;; V.4 specific code to initialize the PIC register
8343 (define_insn "init_v4_pic"
8344 [(set (match_operand:SI 0 "register_operand" "=l")
8345 (unspec [(const_int 0)] 7))]
8346 "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS"
8347 "bl _GLOBAL_OFFSET_TABLE_@local-4"
8348 [(set_attr "type" "branch")
8349 (set_attr "length" "4")])
8352 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
8353 ;; signed & unsigned, and one type of branch.
8355 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
8356 ;; insns, and branches. We store the operands of compares until we see
8358 (define_expand "cmpsi"
8360 (compare (match_operand:SI 0 "gpc_reg_operand" "")
8361 (match_operand:SI 1 "reg_or_short_operand" "")))]
8365 /* Take care of the possibility that operands[1] might be negative but
8366 this might be a logical operation. That insn doesn't exist. */
8367 if (GET_CODE (operands[1]) == CONST_INT
8368 && INTVAL (operands[1]) < 0)
8369 operands[1] = force_reg (SImode, operands[1]);
8371 rs6000_compare_op0 = operands[0];
8372 rs6000_compare_op1 = operands[1];
8373 rs6000_compare_fp_p = 0;
8377 (define_expand "cmpdi"
8379 (compare (match_operand:DI 0 "gpc_reg_operand" "")
8380 (match_operand:DI 1 "reg_or_short_operand" "")))]
8384 /* Take care of the possibility that operands[1] might be negative but
8385 this might be a logical operation. That insn doesn't exist. */
8386 if (GET_CODE (operands[1]) == CONST_INT
8387 && INTVAL (operands[1]) < 0)
8388 operands[1] = force_reg (DImode, operands[1]);
8390 rs6000_compare_op0 = operands[0];
8391 rs6000_compare_op1 = operands[1];
8392 rs6000_compare_fp_p = 0;
8396 (define_expand "cmpsf"
8397 [(set (cc0) (compare (match_operand:SF 0 "gpc_reg_operand" "")
8398 (match_operand:SF 1 "gpc_reg_operand" "")))]
8402 rs6000_compare_op0 = operands[0];
8403 rs6000_compare_op1 = operands[1];
8404 rs6000_compare_fp_p = 1;
8408 (define_expand "cmpdf"
8409 [(set (cc0) (compare (match_operand:DF 0 "gpc_reg_operand" "")
8410 (match_operand:DF 1 "gpc_reg_operand" "")))]
8414 rs6000_compare_op0 = operands[0];
8415 rs6000_compare_op1 = operands[1];
8416 rs6000_compare_fp_p = 1;
8420 (define_expand "beq"
8421 [(set (match_dup 2) (match_dup 1))
8423 (if_then_else (eq (match_dup 2)
8425 (label_ref (match_operand 0 "" ""))
8429 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
8430 operands[1] = gen_rtx_COMPARE (mode,
8431 rs6000_compare_op0, rs6000_compare_op1);
8432 operands[2] = gen_reg_rtx (mode);
8435 (define_expand "bne"
8436 [(set (match_dup 2) (match_dup 1))
8438 (if_then_else (ne (match_dup 2)
8440 (label_ref (match_operand 0 "" ""))
8444 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
8445 operands[1] = gen_rtx_COMPARE (mode,
8446 rs6000_compare_op0, rs6000_compare_op1);
8447 operands[2] = gen_reg_rtx (mode);
8450 (define_expand "blt"
8451 [(set (match_dup 2) (match_dup 1))
8453 (if_then_else (lt (match_dup 2)
8455 (label_ref (match_operand 0 "" ""))
8459 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
8460 operands[1] = gen_rtx_COMPARE (mode,
8461 rs6000_compare_op0, rs6000_compare_op1);
8462 operands[2] = gen_reg_rtx (mode);
8465 (define_expand "bgt"
8466 [(set (match_dup 2) (match_dup 1))
8468 (if_then_else (gt (match_dup 2)
8470 (label_ref (match_operand 0 "" ""))
8474 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
8475 operands[1] = gen_rtx_COMPARE (mode,
8476 rs6000_compare_op0, rs6000_compare_op1);
8477 operands[2] = gen_reg_rtx (mode);
8480 (define_expand "ble"
8481 [(set (match_dup 2) (match_dup 1))
8483 (if_then_else (le (match_dup 2)
8485 (label_ref (match_operand 0 "" ""))
8489 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
8490 operands[1] = gen_rtx_COMPARE (mode,
8491 rs6000_compare_op0, rs6000_compare_op1);
8492 operands[2] = gen_reg_rtx (mode);
8495 (define_expand "bge"
8496 [(set (match_dup 2) (match_dup 1))
8498 (if_then_else (ge (match_dup 2)
8500 (label_ref (match_operand 0 "" ""))
8504 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
8505 operands[1] = gen_rtx_COMPARE (mode,
8506 rs6000_compare_op0, rs6000_compare_op1);
8507 operands[2] = gen_reg_rtx (mode);
8510 (define_expand "bgtu"
8511 [(set (match_dup 2) (match_dup 1))
8513 (if_then_else (gtu (match_dup 2)
8515 (label_ref (match_operand 0 "" ""))
8519 { operands[1] = gen_rtx_COMPARE (CCUNSmode,
8520 rs6000_compare_op0, rs6000_compare_op1);
8521 operands[2] = gen_reg_rtx (CCUNSmode);
8524 (define_expand "bltu"
8525 [(set (match_dup 2) (match_dup 1))
8527 (if_then_else (ltu (match_dup 2)
8529 (label_ref (match_operand 0 "" ""))
8533 { operands[1] = gen_rtx_COMPARE (CCUNSmode,
8534 rs6000_compare_op0, rs6000_compare_op1);
8535 operands[2] = gen_reg_rtx (CCUNSmode);
8538 (define_expand "bgeu"
8539 [(set (match_dup 2) (match_dup 1))
8541 (if_then_else (geu (match_dup 2)
8543 (label_ref (match_operand 0 "" ""))
8547 { operands[1] = gen_rtx_COMPARE (CCUNSmode,
8548 rs6000_compare_op0, rs6000_compare_op1);
8549 operands[2] = gen_reg_rtx (CCUNSmode);
8552 (define_expand "bleu"
8553 [(set (match_dup 2) (match_dup 1))
8555 (if_then_else (leu (match_dup 2)
8557 (label_ref (match_operand 0 "" ""))
8561 { operands[1] = gen_rtx_COMPARE (CCUNSmode,
8562 rs6000_compare_op0, rs6000_compare_op1);
8563 operands[2] = gen_reg_rtx (CCUNSmode);
8566 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
8567 ;; For SEQ, likewise, except that comparisons with zero should be done
8568 ;; with an scc insns. However, due to the order that combine see the
8569 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
8570 ;; the cases we don't want to handle.
8571 (define_expand "seq"
8572 [(set (match_dup 2) (match_dup 1))
8573 (set (match_operand:SI 0 "gpc_reg_operand" "")
8574 (eq:SI (match_dup 2) (const_int 0)))]
8577 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
8578 operands[1] = gen_rtx_COMPARE (mode,
8579 rs6000_compare_op0, rs6000_compare_op1);
8580 operands[2] = gen_reg_rtx (mode);
8583 (define_expand "sne"
8584 [(set (match_dup 2) (match_dup 1))
8585 (set (match_operand:SI 0 "gpc_reg_operand" "")
8586 (ne:SI (match_dup 2) (const_int 0)))]
8589 { if (! rs6000_compare_fp_p)
8592 operands[1] = gen_rtx_COMPARE (CCFPmode,
8593 rs6000_compare_op0, rs6000_compare_op1);
8594 operands[2] = gen_reg_rtx (CCFPmode);
8597 ;; A > 0 is best done using the portable sequence, so fail in that case.
8598 (define_expand "sgt"
8599 [(set (match_dup 2) (match_dup 1))
8600 (set (match_operand:SI 0 "gpc_reg_operand" "")
8601 (gt:SI (match_dup 2) (const_int 0)))]
8604 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
8606 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
8609 operands[1] = gen_rtx_COMPARE (mode,
8610 rs6000_compare_op0, rs6000_compare_op1);
8611 operands[2] = gen_reg_rtx (mode);
8614 ;; A < 0 is best done in the portable way for A an integer.
8615 (define_expand "slt"
8616 [(set (match_dup 2) (match_dup 1))
8617 (set (match_operand:SI 0 "gpc_reg_operand" "")
8618 (lt:SI (match_dup 2) (const_int 0)))]
8621 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
8623 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
8626 operands[1] = gen_rtx_COMPARE (mode,
8627 rs6000_compare_op0, rs6000_compare_op1);
8628 operands[2] = gen_reg_rtx (mode);
8631 (define_expand "sge"
8632 [(set (match_dup 2) (match_dup 1))
8633 (set (match_operand:SI 0 "gpc_reg_operand" "")
8634 (ge:SI (match_dup 2) (const_int 0)))]
8637 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
8638 operands[1] = gen_rtx_COMPARE (mode,
8639 rs6000_compare_op0, rs6000_compare_op1);
8640 operands[2] = gen_reg_rtx (mode);
8643 ;; A <= 0 is best done the portable way for A an integer.
8644 (define_expand "sle"
8645 [(set (match_dup 2) (match_dup 1))
8646 (set (match_operand:SI 0 "gpc_reg_operand" "")
8647 (le:SI (match_dup 2) (const_int 0)))]
8650 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
8652 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
8655 operands[1] = gen_rtx_COMPARE (mode,
8656 rs6000_compare_op0, rs6000_compare_op1);
8657 operands[2] = gen_reg_rtx (mode);
8660 (define_expand "sgtu"
8661 [(set (match_dup 2) (match_dup 1))
8662 (set (match_operand:SI 0 "gpc_reg_operand" "")
8663 (gtu:SI (match_dup 2) (const_int 0)))]
8666 { operands[1] = gen_rtx_COMPARE (CCUNSmode,
8667 rs6000_compare_op0, rs6000_compare_op1);
8668 operands[2] = gen_reg_rtx (CCUNSmode);
8671 (define_expand "sltu"
8672 [(set (match_dup 2) (match_dup 1))
8673 (set (match_operand:SI 0 "gpc_reg_operand" "")
8674 (ltu:SI (match_dup 2) (const_int 0)))]
8677 { operands[1] = gen_rtx_COMPARE (CCUNSmode,
8678 rs6000_compare_op0, rs6000_compare_op1);
8679 operands[2] = gen_reg_rtx (CCUNSmode);
8682 (define_expand "sgeu"
8683 [(set (match_dup 2) (match_dup 1))
8684 (set (match_operand:SI 0 "gpc_reg_operand" "")
8685 (geu:SI (match_dup 2) (const_int 0)))]
8688 { operands[1] = gen_rtx_COMPARE (CCUNSmode,
8689 rs6000_compare_op0, rs6000_compare_op1);
8690 operands[2] = gen_reg_rtx (CCUNSmode);
8693 (define_expand "sleu"
8694 [(set (match_dup 2) (match_dup 1))
8695 (set (match_operand:SI 0 "gpc_reg_operand" "")
8696 (leu:SI (match_dup 2) (const_int 0)))]
8699 { operands[1] = gen_rtx_COMPARE (CCUNSmode,
8700 rs6000_compare_op0, rs6000_compare_op1);
8701 operands[2] = gen_reg_rtx (CCUNSmode);
8704 ;; Here are the actual compare insns.
8706 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
8707 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
8708 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
8710 "{cmp%I2|cmpw%I2} %0,%1,%2"
8711 [(set_attr "type" "compare")])
8714 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
8715 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r")
8716 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
8719 [(set_attr "type" "compare")])
8721 ;; If we are comparing a register for equality with a large constant,
8722 ;; we can do this with an XOR followed by a compare. But we need a scratch
8723 ;; register for the result of the XOR.
8726 [(set (match_operand:CC 0 "cc_reg_operand" "")
8727 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
8728 (match_operand:SI 2 "non_short_cint_operand" "")))
8729 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
8730 "find_single_use (operands[0], insn, 0)
8731 && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
8732 || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
8733 [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
8734 (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
8737 /* Get the constant we are comparing against, C, and see what it looks like
8738 sign-extended to 16 bits. Then see what constant could be XOR'ed
8739 with C to get the sign-extended value. */
8741 int c = INTVAL (operands[2]);
8742 int sextc = (c << 16) >> 16;
8743 int xorv = c ^ sextc;
8745 operands[4] = GEN_INT (xorv);
8746 operands[5] = GEN_INT (sextc);
8750 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
8751 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
8752 (match_operand:SI 2 "reg_or_u_short_operand" "rI")))]
8754 "{cmpl%I2|cmplw%I2} %0,%1,%W2"
8755 [(set_attr "type" "compare")])
8758 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
8759 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
8760 (match_operand:DI 2 "reg_or_u_short_operand" "rI")))]
8762 "cmpld%I2 %0,%1,%W2"
8763 [(set_attr "type" "compare")])
8765 ;; The following two insns don't exist as single insns, but if we provide
8766 ;; them, we can swap an add and compare, which will enable us to overlap more
8767 ;; of the required delay between a compare and branch. We generate code for
8768 ;; them by splitting.
8771 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
8772 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
8773 (match_operand:SI 2 "short_cint_operand" "i")))
8774 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8775 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
8778 [(set_attr "length" "8")])
8781 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
8782 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
8783 (match_operand:SI 2 "u_short_cint_operand" "i")))
8784 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8785 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
8788 [(set_attr "length" "8")])
8791 [(set (match_operand:CC 3 "cc_reg_operand" "")
8792 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
8793 (match_operand:SI 2 "short_cint_operand" "")))
8794 (set (match_operand:SI 0 "gpc_reg_operand" "")
8795 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
8797 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
8798 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
8801 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
8802 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
8803 (match_operand:SI 2 "u_short_cint_operand" "")))
8804 (set (match_operand:SI 0 "gpc_reg_operand" "")
8805 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
8807 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
8808 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
8811 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
8812 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
8813 (match_operand:SF 2 "gpc_reg_operand" "f")))]
8816 [(set_attr "type" "fpcompare")])
8819 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
8820 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
8821 (match_operand:DF 2 "gpc_reg_operand" "f")))]
8824 [(set_attr "type" "fpcompare")])
8826 ;; Now we have the scc insns. We can do some combinations because of the
8827 ;; way the machine works.
8829 ;; Note that this is probably faster if we can put an insn between the
8830 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
8831 ;; cases the insns below which don't use an intermediate CR field will
8834 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8835 (match_operator:SI 1 "scc_comparison_operator"
8836 [(match_operand 2 "cc_reg_operand" "y")
8839 "%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%J1,1"
8840 [(set_attr "length" "12")])
8843 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
8844 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
8845 [(match_operand 2 "cc_reg_operand" "y")
8848 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
8849 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
8851 "%D1mfcr %3\;{rlinm.|rlwinm.} %3,%3,%J1,1"
8852 [(set_attr "type" "delayed_compare")
8853 (set_attr "length" "12")])
8856 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8857 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
8858 [(match_operand 2 "cc_reg_operand" "y")
8860 (match_operand:SI 3 "const_int_operand" "n")))]
8864 int is_bit = ccr_bit (operands[1], 1);
8865 int put_bit = 31 - (INTVAL (operands[3]) & 31);
8868 if (is_bit >= put_bit)
8869 count = is_bit - put_bit;
8871 count = 32 - (put_bit - is_bit);
8873 operands[4] = GEN_INT (count);
8874 operands[5] = GEN_INT (put_bit);
8876 return \"%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
8878 [(set_attr "length" "12")])
8881 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
8883 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
8884 [(match_operand 2 "cc_reg_operand" "y")
8886 (match_operand:SI 3 "const_int_operand" "n"))
8888 (set (match_operand:SI 4 "gpc_reg_operand" "=r")
8889 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
8894 int is_bit = ccr_bit (operands[1], 1);
8895 int put_bit = 31 - (INTVAL (operands[3]) & 31);
8898 if (is_bit >= put_bit)
8899 count = is_bit - put_bit;
8901 count = 32 - (put_bit - is_bit);
8903 operands[5] = GEN_INT (count);
8904 operands[6] = GEN_INT (put_bit);
8906 return \"%D1mfcr %4\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
8908 [(set_attr "type" "delayed_compare")
8909 (set_attr "length" "12")])
8911 ;; If we are comparing the result of two comparisons, this can be done
8912 ;; using creqv or crxor.
8915 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
8916 (compare:CCEQ (match_operator 1 "scc_comparison_operator"
8917 [(match_operand 2 "cc_reg_operand" "y")
8919 (match_operator 3 "scc_comparison_operator"
8920 [(match_operand 4 "cc_reg_operand" "y")
8922 "REGNO (operands[2]) != REGNO (operands[4])"
8925 enum rtx_code code1, code2;
8927 code1 = GET_CODE (operands[1]);
8928 code2 = GET_CODE (operands[3]);
8930 if ((code1 == EQ || code1 == LT || code1 == GT
8931 || code1 == LTU || code1 == GTU
8932 || (code1 != NE && GET_MODE (operands[2]) == CCFPmode))
8934 (code2 == EQ || code2 == LT || code2 == GT
8935 || code2 == LTU || code2 == GTU
8936 || (code2 != NE && GET_MODE (operands[4]) == CCFPmode)))
8937 return \"%C1%C3crxor %E0,%j1,%j3\";
8939 return \"%C1%C3creqv %E0,%j1,%j3\";
8941 [(set_attr "length" "12")])
8943 ;; There is a 3 cycle delay between consecutive mfcr instructions
8944 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
8947 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8948 (match_operator:SI 1 "scc_comparison_operator"
8949 [(match_operand 2 "cc_reg_operand" "y")
8951 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
8952 (match_operator:SI 4 "scc_comparison_operator"
8953 [(match_operand 5 "cc_reg_operand" "y")
8955 "REGNO (operands[2]) != REGNO (operands[5])"
8956 "%D1%D4mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
8957 [(set_attr "length" "20")])
8959 ;; There are some scc insns that can be done directly, without a compare.
8960 ;; These are faster because they don't involve the communications between
8961 ;; the FXU and branch units. In fact, we will be replacing all of the
8962 ;; integer scc insns here or in the portable methods in emit_store_flag.
8964 ;; Also support (neg (scc ..)) since that construct is used to replace
8965 ;; branches, (plus (scc ..) ..) since that construct is common and
8966 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
8967 ;; cases where it is no more expensive than (neg (scc ..)).
8969 ;; Have reload force a constant into a register for the simple insns that
8970 ;; otherwise won't accept constants. We do this because it is faster than
8971 ;; the cmp/mfcr sequence we would otherwise generate.
8974 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
8975 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
8976 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I")))
8977 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
8980 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
8981 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
8982 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
8983 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
8984 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
8985 [(set_attr "length" "12,8,12,12,12")])
8988 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r")
8989 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r")
8990 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I")))
8991 (clobber (match_scratch:DI 3 "=r,&r,r,r,r"))]
8994 xor %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0
8995 subfic %3,%1,0\;adde %0,%3,%1
8996 xori %0,%1,%b2\;subfic %3,%0,0\;adde %0,%3,%0
8997 xoris %0,%1,%u2\;subfic %3,%0,0\;adde %0,%3,%0
8998 subfic %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0"
8999 [(set_attr "length" "12,8,12,12,12")])
9002 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x")
9004 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
9005 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
9007 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
9008 (eq:SI (match_dup 1) (match_dup 2)))
9009 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
9012 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
9013 {sfi|subfic} %3,%1,0\;{ae.|adde.} %0,%3,%1
9014 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
9015 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
9016 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0"
9017 [(set_attr "type" "compare")
9018 (set_attr "length" "12,8,12,12,12")])
9021 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x")
9023 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r")
9024 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I"))
9026 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r")
9027 (eq:DI (match_dup 1) (match_dup 2)))
9028 (clobber (match_scratch:DI 3 "=r,&r,r,r,r"))]
9031 xor %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
9032 subfic %3,%1,0\;adde. %0,%3,%1
9033 xori %0,%1,%b2\;subfic %3,%0,0\;adde. %0,%3,%0
9034 xoris %0,%1,%u2\;subfic %3,%0,0\;adde. %0,%3,%0
9035 subfic %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0"
9036 [(set_attr "type" "compare")
9037 (set_attr "length" "12,8,12,12,12")])
9039 ;; We have insns of the form shown by the first define_insn below. If
9040 ;; there is something inside the comparison operation, we must split it.
9042 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9043 (plus:SI (match_operator 1 "comparison_operator"
9044 [(match_operand:SI 2 "" "")
9046 "reg_or_cint_operand" "")])
9047 (match_operand:SI 4 "gpc_reg_operand" "")))
9048 (clobber (match_operand:SI 5 "register_operand" ""))]
9049 "! gpc_reg_operand (operands[2], SImode)"
9050 [(set (match_dup 5) (match_dup 2))
9051 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
9055 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
9056 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
9057 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
9058 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))
9059 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
9062 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
9063 {sfi|subfic} %4,%1,0\;{aze|addze} %0,%3
9064 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
9065 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
9066 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3"
9067 [(set_attr "length" "12,8,12,12,12")])
9070 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x")
9073 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
9074 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
9075 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r"))
9077 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
9080 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
9081 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
9082 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
9083 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
9084 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3"
9085 [(set_attr "type" "compare")
9086 (set_attr "length" "12,8,12,12,12")])
9089 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,x,x,x")
9092 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
9093 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
9094 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r"))
9096 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
9097 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
9098 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
9101 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
9102 {sfi|subfic} %4,%1,0\;{aze.|addze.} %0,%3
9103 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
9104 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
9105 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3"
9106 [(set_attr "type" "compare")
9107 (set_attr "length" "12,8,12,12,12")])
9110 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
9111 (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
9112 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))))]
9115 xor %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
9116 {ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0
9117 {xoril|xori} %0,%1,%b2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
9118 {xoriu|xoris} %0,%1,%u2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
9119 {sfi|subfic} %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
9120 [(set_attr "length" "12,8,12,12,12")])
9122 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
9123 ;; since it nabs/sr is just as fast.
9125 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
9126 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
9128 (clobber (match_scratch:SI 2 "=&r"))]
9130 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
9131 [(set_attr "length" "8")])
9134 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9135 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
9137 (clobber (match_scratch:DI 2 "=&r"))]
9139 "addic %2,%1,-1\;subfe %0,%2,%1"
9140 [(set_attr "length" "8")])
9142 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
9144 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9145 (plus:SI (lshiftrt:SI
9146 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
9148 (match_operand:SI 2 "gpc_reg_operand" "r")))
9149 (clobber (match_scratch:SI 3 "=&r"))]
9151 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
9152 [(set_attr "length" "8")])
9155 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9156 (plus:DI (lshiftrt:DI
9157 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
9159 (match_operand:DI 2 "gpc_reg_operand" "r")))
9160 (clobber (match_scratch:DI 3 "=&r"))]
9162 "addic %3,%1,-1\;addze %0,%2"
9163 [(set_attr "length" "8")])
9166 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
9168 (plus:SI (lshiftrt:SI
9169 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
9171 (match_operand:SI 2 "gpc_reg_operand" "r"))
9173 (clobber (match_scratch:SI 3 "=&r"))]
9175 "{ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2"
9176 [(set_attr "type" "compare")
9177 (set_attr "length" "8")])
9180 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
9182 (plus:DI (lshiftrt:DI
9183 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
9185 (match_operand:DI 2 "gpc_reg_operand" "r"))
9187 (clobber (match_scratch:DI 3 "=&r"))]
9189 "addic %3,%1,-1\;addze. %3,%2"
9190 [(set_attr "type" "compare")
9191 (set_attr "length" "8")])
9194 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
9196 (plus:SI (lshiftrt:SI
9197 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
9199 (match_operand:SI 2 "gpc_reg_operand" "r"))
9201 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
9202 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
9204 (clobber (match_scratch:SI 3 "=&r"))]
9206 "{ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2"
9207 [(set_attr "type" "compare")
9208 (set_attr "length" "8")])
9211 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
9213 (plus:DI (lshiftrt:DI
9214 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
9216 (match_operand:DI 2 "gpc_reg_operand" "r"))
9218 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
9219 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
9221 (clobber (match_scratch:DI 3 "=&r"))]
9223 "addic %3,%1,-1\;addze. %0,%2"
9224 [(set_attr "type" "compare")
9225 (set_attr "length" "8")])
9228 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9229 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9230 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
9231 (clobber (match_scratch:SI 3 "=r,X"))]
9234 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
9235 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
9236 [(set_attr "length" "12")])
9239 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x")
9241 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9242 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
9244 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9245 (le:SI (match_dup 1) (match_dup 2)))
9246 (clobber (match_scratch:SI 3 "=r,X"))]
9249 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
9250 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31"
9251 [(set_attr "type" "compare,delayed_compare")
9252 (set_attr "length" "12")])
9255 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9256 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9257 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
9258 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
9259 (clobber (match_scratch:SI 4 "=&r,&r"))]
9262 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
9263 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze|addze} %0,%3"
9264 [(set_attr "length" "12")])
9267 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
9269 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9270 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
9271 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9273 (clobber (match_scratch:SI 4 "=&r,&r"))]
9276 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
9277 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3"
9278 [(set_attr "type" "compare")
9279 (set_attr "length" "12")])
9282 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
9284 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9285 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
9286 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9288 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9289 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
9290 (clobber (match_scratch:SI 4 "=&r,&r"))]
9293 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
9294 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %0,%3"
9295 [(set_attr "type" "compare")
9296 (set_attr "length" "12")])
9299 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9300 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9301 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
9304 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
9305 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
9306 [(set_attr "length" "12")])
9309 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9310 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9311 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
9313 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
9314 [(set_attr "length" "12")])
9317 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
9319 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9320 (match_operand:SI 2 "reg_or_short_operand" "rI"))
9322 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
9323 (leu:SI (match_dup 1) (match_dup 2)))]
9325 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0"
9326 [(set_attr "type" "compare")
9327 (set_attr "length" "12")])
9330 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9331 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9332 (match_operand:SI 2 "reg_or_short_operand" "rI"))
9333 (match_operand:SI 3 "gpc_reg_operand" "r")))
9334 (clobber (match_scratch:SI 4 "=&r"))]
9336 "{sf%I2|subf%I2c} %4,%1,%2\;{aze|addze} %0,%3"
9337 [(set_attr "length" "8")])
9340 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
9342 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9343 (match_operand:SI 2 "reg_or_short_operand" "rI"))
9344 (match_operand:SI 3 "gpc_reg_operand" "r"))
9346 (clobber (match_scratch:SI 4 "=&r"))]
9348 "{sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3"
9349 [(set_attr "type" "compare")
9350 (set_attr "length" "8")])
9353 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
9355 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9356 (match_operand:SI 2 "reg_or_short_operand" "rI"))
9357 (match_operand:SI 3 "gpc_reg_operand" "r"))
9359 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
9360 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
9361 (clobber (match_scratch:SI 4 "=&r"))]
9363 "{sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %0,%3"
9364 [(set_attr "type" "compare")
9365 (set_attr "length" "8")])
9368 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9369 (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9370 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
9372 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
9373 [(set_attr "length" "12")])
9376 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9378 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9379 (match_operand:SI 2 "reg_or_short_operand" "rI")))
9380 (match_operand:SI 3 "gpc_reg_operand" "r")))
9381 (clobber (match_scratch:SI 4 "=&r"))]
9383 "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4"
9384 [(set_attr "length" "12")])
9387 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
9390 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9391 (match_operand:SI 2 "reg_or_short_operand" "rI")))
9392 (match_operand:SI 3 "gpc_reg_operand" "r"))
9394 (clobber (match_scratch:SI 4 "=&r"))]
9396 "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4"
9397 [(set_attr "type" "compare")
9398 (set_attr "length" "12")])
9401 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
9404 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9405 (match_operand:SI 2 "reg_or_short_operand" "rI")))
9406 (match_operand:SI 3 "gpc_reg_operand" "r"))
9408 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
9409 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
9410 (clobber (match_scratch:SI 4 "=&r"))]
9412 "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4"
9413 [(set_attr "type" "compare")
9414 (set_attr "length" "12")])
9417 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9418 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9419 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
9421 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
9422 [(set_attr "length" "12")])
9425 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
9427 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9428 (match_operand:SI 2 "reg_or_short_operand" "rI"))
9430 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
9431 (lt:SI (match_dup 1) (match_dup 2)))]
9433 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31"
9434 [(set_attr "type" "delayed_compare")
9435 (set_attr "length" "12")])
9438 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9439 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9440 (match_operand:SI 2 "reg_or_short_operand" "rI"))
9441 (match_operand:SI 3 "gpc_reg_operand" "r")))
9442 (clobber (match_scratch:SI 4 "=&r"))]
9444 "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze|addze} %0,%3"
9445 [(set_attr "length" "12")])
9448 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
9450 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9451 (match_operand:SI 2 "reg_or_short_operand" "rI"))
9452 (match_operand:SI 3 "gpc_reg_operand" "r"))
9454 (clobber (match_scratch:SI 4 "=&r"))]
9456 "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3"
9457 [(set_attr "type" "compare")
9458 (set_attr "length" "12")])
9461 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
9463 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9464 (match_operand:SI 2 "reg_or_short_operand" "rI"))
9465 (match_operand:SI 3 "gpc_reg_operand" "r"))
9467 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
9468 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
9469 (clobber (match_scratch:SI 4 "=&r"))]
9471 "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %0,%3"
9472 [(set_attr "type" "compare")
9473 (set_attr "length" "12")])
9476 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9477 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9478 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
9480 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
9481 [(set_attr "length" "12")])
9484 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9485 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9486 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
9489 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg %0,%0
9490 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
9491 [(set_attr "length" "12")])
9494 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
9496 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9497 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
9499 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9500 (ltu:SI (match_dup 1) (match_dup 2)))]
9503 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
9504 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0"
9505 [(set_attr "type" "compare")
9506 (set_attr "length" "12")])
9509 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9510 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9511 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
9512 (match_operand:SI 3 "reg_or_short_operand" "rI,rI")))
9513 (clobber (match_scratch:SI 4 "=&r,&r"))]
9516 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
9517 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
9518 [(set_attr "length" "12")])
9521 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
9523 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9524 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
9525 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9527 (clobber (match_scratch:SI 4 "=&r,&r"))]
9530 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
9531 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3"
9532 [(set_attr "type" "compare")
9533 (set_attr "length" "12")])
9536 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
9538 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9539 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
9540 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9542 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9543 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
9544 (clobber (match_scratch:SI 4 "=&r,&r"))]
9547 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3
9548 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3"
9549 [(set_attr "type" "compare")
9550 (set_attr "length" "12")])
9553 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9554 (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9555 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
9558 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
9559 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
9560 [(set_attr "length" "8")])
9563 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9564 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9565 (match_operand:SI 2 "reg_or_short_operand" "rI")))
9566 (clobber (match_scratch:SI 3 "=r"))]
9568 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
9569 [(set_attr "length" "12")])
9572 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
9574 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9575 (match_operand:SI 2 "reg_or_short_operand" "rI"))
9577 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
9578 (ge:SI (match_dup 1) (match_dup 2)))
9579 (clobber (match_scratch:SI 3 "=r"))]
9581 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3"
9582 [(set_attr "type" "compare")
9583 (set_attr "length" "12")])
9586 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9587 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9588 (match_operand:SI 2 "reg_or_short_operand" "rI"))
9589 (match_operand:SI 3 "gpc_reg_operand" "r")))
9590 (clobber (match_scratch:SI 4 "=&r"))]
9592 "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3"
9593 [(set_attr "length" "12")])
9596 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
9598 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9599 (match_operand:SI 2 "reg_or_short_operand" "rI"))
9600 (match_operand:SI 3 "gpc_reg_operand" "r"))
9602 (clobber (match_scratch:SI 4 "=&r"))]
9604 "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3"
9605 [(set_attr "type" "compare")
9606 (set_attr "length" "12")])
9609 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
9611 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9612 (match_operand:SI 2 "reg_or_short_operand" "rI"))
9613 (match_operand:SI 3 "gpc_reg_operand" "r"))
9615 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
9616 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
9617 (clobber (match_scratch:SI 4 "=&r"))]
9619 "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3"
9620 [(set_attr "type" "compare")
9621 (set_attr "length" "12")])
9624 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9625 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9626 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
9628 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
9629 [(set_attr "length" "12")])
9631 ;; This is (and (neg (ge X (const_int 0))) Y).
9633 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9636 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
9638 (match_operand:SI 2 "gpc_reg_operand" "r")))
9639 (clobber (match_scratch:SI 3 "=&r"))]
9641 "{srai|srawi} %3,%1,31\;andc %0,%2,%3"
9642 [(set_attr "length" "8")])
9645 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
9649 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
9651 (match_operand:SI 2 "gpc_reg_operand" "r"))
9653 (clobber (match_scratch:SI 3 "=&r"))]
9655 "{srai|srawi} %3,%1,31\;andc. %3,%2,%3"
9656 [(set_attr "type" "compare")
9657 (set_attr "length" "8")])
9660 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
9664 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
9666 (match_operand:SI 2 "gpc_reg_operand" "r"))
9668 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
9669 (and:SI (neg:SI (lshiftrt:SI (not:SI (match_dup 1))
9672 (clobber (match_scratch:SI 3 "=&r"))]
9674 "{srai|srawi} %3,%1,31\;andc. %0,%2,%3"
9675 [(set_attr "type" "compare")
9676 (set_attr "length" "8")])
9679 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9680 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9681 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
9684 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
9685 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
9686 [(set_attr "length" "12")])
9689 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
9691 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9692 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
9694 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9695 (geu:SI (match_dup 1) (match_dup 2)))]
9698 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
9699 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0"
9700 [(set_attr "type" "compare")
9701 (set_attr "length" "12")])
9704 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9705 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9706 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
9707 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
9708 (clobber (match_scratch:SI 4 "=&r,&r"))]
9711 {sf|subfc} %4,%2,%1\;{aze|addze} %0,%3
9712 {ai|addic} %4,%1,%n2\;{aze|addze} %0,%3"
9713 [(set_attr "length" "8")])
9716 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
9718 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9719 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
9720 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9722 (clobber (match_scratch:SI 4 "=&r,&r"))]
9725 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
9726 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3"
9727 [(set_attr "type" "compare")
9728 (set_attr "length" "8")])
9731 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
9733 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9734 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
9735 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9737 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9738 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
9739 (clobber (match_scratch:SI 4 "=&r,&r"))]
9742 {sf|subfc} %4,%2,%1\;{aze.|addze.} %0,%3
9743 {ai|addic} %4,%1,%n2\;{aze.|addze.} %0,%3"
9744 [(set_attr "type" "compare")
9745 (set_attr "length" "8")])
9748 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9749 (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9750 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
9753 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
9754 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
9755 [(set_attr "length" "12")])
9758 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9760 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9761 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
9762 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
9763 (clobber (match_scratch:SI 4 "=&r,&r"))]
9766 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4
9767 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4"
9768 [(set_attr "length" "12")])
9771 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
9774 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9775 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
9776 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9778 (clobber (match_scratch:SI 4 "=&r,&r"))]
9781 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
9782 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4"
9783 [(set_attr "type" "compare")
9784 (set_attr "length" "12")])
9787 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
9790 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9791 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
9792 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9794 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9795 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
9796 (clobber (match_scratch:SI 4 "=&r,&r"))]
9799 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4
9800 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4"
9801 [(set_attr "type" "compare")
9802 (set_attr "length" "12")])
9805 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9806 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9809 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31"
9810 [(set_attr "length" "12")])
9813 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
9815 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9818 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
9819 (gt:SI (match_dup 1) (const_int 0)))]
9821 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri.|srwi.} %0,%0,31"
9822 [(set_attr "type" "delayed_compare")
9823 (set_attr "length" "12")])
9826 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9827 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9828 (match_operand:SI 2 "reg_or_short_operand" "r")))]
9830 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
9831 [(set_attr "length" "12")])
9834 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
9836 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9837 (match_operand:SI 2 "reg_or_short_operand" "r"))
9839 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
9840 (gt:SI (match_dup 1) (match_dup 2)))]
9842 "doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31"
9843 [(set_attr "type" "delayed_compare")
9844 (set_attr "length" "12")])
9847 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9848 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9850 (match_operand:SI 2 "gpc_reg_operand" "r")))
9851 (clobber (match_scratch:SI 3 "=&r"))]
9853 "{a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze|addze} %0,%2"
9854 [(set_attr "length" "12")])
9857 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
9859 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9861 (match_operand:SI 2 "gpc_reg_operand" "r"))
9863 (clobber (match_scratch:SI 3 "=&r"))]
9865 "{a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2"
9866 [(set_attr "type" "compare")
9867 (set_attr "length" "12")])
9870 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
9872 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9874 (match_operand:SI 2 "gpc_reg_operand" "r"))
9876 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
9877 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
9878 (clobber (match_scratch:SI 3 "=&r"))]
9880 "{a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %0,%2"
9881 [(set_attr "type" "compare")
9882 (set_attr "length" "12")])
9885 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9886 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9887 (match_operand:SI 2 "reg_or_short_operand" "r"))
9888 (match_operand:SI 3 "gpc_reg_operand" "r")))
9889 (clobber (match_scratch:SI 4 "=&r"))]
9891 "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze|addze} %0,%3"
9892 [(set_attr "length" "12")])
9895 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
9897 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9898 (match_operand:SI 2 "reg_or_short_operand" "r"))
9899 (match_operand:SI 3 "gpc_reg_operand" "r"))
9901 (clobber (match_scratch:SI 4 "=&r"))]
9903 "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3"
9904 [(set_attr "type" "compare")
9905 (set_attr "length" "12")])
9908 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
9910 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9911 (match_operand:SI 2 "reg_or_short_operand" "r"))
9912 (match_operand:SI 3 "gpc_reg_operand" "r"))
9914 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
9915 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
9916 (clobber (match_scratch:SI 4 "=&r"))]
9918 "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %0,%3"
9919 [(set_attr "type" "compare")
9920 (set_attr "length" "12")])
9923 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9924 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9927 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{srai|srawi} %0,%0,31"
9928 [(set_attr "length" "12")])
9931 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9932 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9933 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
9935 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
9936 [(set_attr "length" "12")])
9939 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9940 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9941 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
9943 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
9944 [(set_attr "length" "12")])
9947 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
9949 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9950 (match_operand:SI 2 "reg_or_short_operand" "rI"))
9952 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
9953 (gtu:SI (match_dup 1) (match_dup 2)))]
9955 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0"
9956 [(set_attr "type" "compare")
9957 (set_attr "length" "12")])
9960 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9961 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9962 (match_operand:SI 2 "reg_or_short_operand" "I,rI"))
9963 (match_operand:SI 3 "reg_or_short_operand" "r,rI")))
9964 (clobber (match_scratch:SI 4 "=&r,&r"))]
9967 {ai|addic} %4,%1,%k2\;{aze|addze} %0,%3
9968 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3"
9969 [(set_attr "length" "8,12")])
9972 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
9974 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9975 (match_operand:SI 2 "reg_or_short_operand" "I,r"))
9976 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9978 (clobber (match_scratch:SI 4 "=&r,&r"))]
9981 {ai|addic} %4,%1,%k2\;{aze.|addze.} %4,%3
9982 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3"
9983 [(set_attr "type" "compare")
9984 (set_attr "length" "8,12")])
9987 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
9989 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9990 (match_operand:SI 2 "reg_or_short_operand" "I,r"))
9991 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9993 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9994 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
9995 (clobber (match_scratch:SI 4 "=&r,&r"))]
9998 {ai|addic} %4,%1,%k2\;{aze.|addze.} %0,%3
9999 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3"
10000 [(set_attr "type" "compare")
10001 (set_attr "length" "8,12")])
10004 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10005 (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
10006 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
10008 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
10009 [(set_attr "length" "8")])
10011 ;; Define both directions of branch and return. If we need a reload
10012 ;; register, we'd rather use CR0 since it is much easier to copy a
10013 ;; register CC value to there.
10017 (if_then_else (match_operator 1 "branch_comparison_operator"
10019 "cc_reg_operand" "x,?y")
10021 (label_ref (match_operand 0 "" ""))
10026 if (get_attr_length (insn) == 8)
10027 return \"%C1bc %t1,%j1,%l0\";
10029 return \"%C1bc %T1,%j1,%$+8\;b %l0\";
10032 [(set_attr "type" "branch")])
10036 (if_then_else (match_operator 0 "branch_comparison_operator"
10038 "cc_reg_operand" "x,?y")
10043 "{%C0bcr|%C0bclr} %t0,%j0"
10044 [(set_attr "type" "branch")
10045 (set_attr "length" "8")])
10049 (if_then_else (match_operator 1 "branch_comparison_operator"
10051 "cc_reg_operand" "x,?y")
10054 (label_ref (match_operand 0 "" ""))))]
10058 if (get_attr_length (insn) == 8)
10059 return \"%C1bc %T1,%j1,%l0\";
10061 return \"%C1bc %t1,%j1,%$+8\;b %l0\";
10063 [(set_attr "type" "branch")])
10067 (if_then_else (match_operator 0 "branch_comparison_operator"
10069 "cc_reg_operand" "x,?y")
10074 "{%C0bcr|%C0bclr} %T0,%j0"
10075 [(set_attr "type" "branch")
10076 (set_attr "length" "8")])
10078 ;; Unconditional branch and return.
10080 (define_insn "jump"
10082 (label_ref (match_operand 0 "" "")))]
10085 [(set_attr "type" "branch")])
10087 (define_insn "return"
10091 [(set_attr "type" "jmpreg")])
10093 (define_insn "indirect_jump"
10094 [(set (pc) (match_operand:SI 0 "register_operand" "c,l"))]
10099 [(set_attr "type" "jmpreg")])
10102 [(set (pc) (match_operand:DI 0 "register_operand" "c,l"))]
10107 [(set_attr "type" "jmpreg")])
10109 ;; Table jump for switch statements:
10110 (define_expand "tablejump"
10111 [(use (match_operand 0 "" ""))
10112 (use (label_ref (match_operand 1 "" "")))]
10117 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
10119 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
10123 (define_expand "tablejumpsi"
10124 [(set (match_dup 3)
10125 (plus:SI (match_operand:SI 0 "" "")
10127 (parallel [(set (pc) (match_dup 3))
10128 (use (label_ref (match_operand 1 "" "")))])]
10131 { operands[0] = force_reg (SImode, operands[0]);
10132 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (VOIDmode, operands[1]));
10133 operands[3] = gen_reg_rtx (SImode);
10136 (define_expand "tablejumpdi"
10137 [(set (match_dup 3)
10138 (plus:DI (match_operand:DI 0 "" "")
10140 (parallel [(set (pc) (match_dup 3))
10141 (use (label_ref (match_operand 1 "" "")))])]
10144 { operands[0] = force_reg (DImode, operands[0]);
10145 operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (VOIDmode, operands[1]));
10146 operands[3] = gen_reg_rtx (DImode);
10151 (match_operand:SI 0 "register_operand" "c,l"))
10152 (use (label_ref (match_operand 1 "" "")))]
10157 [(set_attr "type" "jmpreg")])
10161 (match_operand:DI 0 "register_operand" "c,l"))
10162 (use (label_ref (match_operand 1 "" "")))]
10167 [(set_attr "type" "jmpreg")])
10172 "{cror 0,0,0|nop}")
10174 ;; Define the subtract-one-and-jump insns, starting with the template
10175 ;; so loop.c knows what to generate.
10177 (define_expand "decrement_and_branch_on_count"
10178 [(parallel [(set (pc) (if_then_else (ne (match_operand:SI 0 "register_operand" "")
10180 (label_ref (match_operand 1 "" ""))
10183 (plus:SI (match_dup 0)
10185 (clobber (match_scratch:CC 2 ""))
10186 (clobber (match_scratch:SI 3 ""))])]
10190 ;; We need to be able to do this for any operand, including MEM, or we
10191 ;; will cause reload to blow up since we don't allow output reloads on
10193 ;; In order that the length attribute is calculated correctly, the
10194 ;; label MUST be operand 0.
10198 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r")
10200 (label_ref (match_operand 0 "" ""))
10202 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
10203 (plus:SI (match_dup 1)
10205 (clobber (match_scratch:CC 3 "=X,&x,&x"))
10206 (clobber (match_scratch:SI 4 "=X,X,r"))]
10210 if (which_alternative != 0)
10212 else if (get_attr_length (insn) == 8)
10213 return \"{bdn|bdnz} %l0\";
10215 return \"bdz %$+8\;b %l0\";
10217 [(set_attr "type" "branch")
10218 (set_attr "length" "*,12,16")])
10222 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r")
10225 (label_ref (match_operand 0 "" ""))))
10226 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
10227 (plus:SI (match_dup 1)
10229 (clobber (match_scratch:CC 3 "=X,&x,&x"))
10230 (clobber (match_scratch:SI 4 "=X,X,r"))]
10234 if (which_alternative != 0)
10236 else if (get_attr_length (insn) == 8)
10237 return \"bdz %l0\";
10239 return \"{bdn|bdnz} %$+8\;b %l0\";
10241 [(set_attr "type" "branch")
10242 (set_attr "length" "*,12,16")])
10244 ;; Similar, but we can use GE since we have a REG_NONNEG.
10247 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
10249 (label_ref (match_operand 0 "" ""))
10251 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
10252 (plus:SI (match_dup 1)
10254 (clobber (match_scratch:CC 3 "=X,&x,&X"))
10255 (clobber (match_scratch:SI 4 "=X,X,r"))]
10256 "find_reg_note (insn, REG_NONNEG, 0)"
10259 if (which_alternative != 0)
10261 else if (get_attr_length (insn) == 8)
10262 return \"{bdn|bdnz} %l0\";
10264 return \"bdz %$+8\;b %l0\";
10266 [(set_attr "type" "branch")
10267 (set_attr "length" "*,12,16")])
10271 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
10274 (label_ref (match_operand 0 "" ""))))
10275 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
10276 (plus:SI (match_dup 1)
10278 (clobber (match_scratch:CC 3 "=X,&x,&X"))
10279 (clobber (match_scratch:SI 4 "=X,X,r"))]
10280 "find_reg_note (insn, REG_NONNEG, 0)"
10283 if (which_alternative != 0)
10285 else if (get_attr_length (insn) == 8)
10286 return \"bdz %l0\";
10288 return \"{bdn|bdnz} %$+8\;b %l0\";
10290 [(set_attr "type" "branch")
10291 (set_attr "length" "*,12,16")])
10295 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r")
10297 (label_ref (match_operand 0 "" ""))
10299 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
10300 (plus:SI (match_dup 1)
10302 (clobber (match_scratch:CC 3 "=X,&x,&x"))
10303 (clobber (match_scratch:SI 4 "=X,X,r"))]
10307 if (which_alternative != 0)
10309 else if (get_attr_length (insn) == 8)
10310 return \"bdz %l0\";
10312 return \"{bdn|bdnz} %$+8\;b %l0\";
10314 [(set_attr "type" "branch")
10315 (set_attr "length" "*,12,16")])
10319 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r")
10322 (label_ref (match_operand 0 "" ""))))
10323 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
10324 (plus:SI (match_dup 1)
10326 (clobber (match_scratch:CC 3 "=X,&x,&x"))
10327 (clobber (match_scratch:SI 4 "=X,X,r"))]
10331 if (which_alternative != 0)
10333 else if (get_attr_length (insn) == 8)
10334 return \"{bdn|bdnz} %l0\";
10336 return \"bdz %$+8\;b %l0\";
10338 [(set_attr "type" "branch")
10339 (set_attr "length" "*,12,16")])
10343 (if_then_else (match_operator 2 "comparison_operator"
10344 [(match_operand:SI 1 "gpc_reg_operand" "")
10346 (match_operand 5 "" "")
10347 (match_operand 6 "" "")))
10348 (set (match_operand:SI 0 "gpc_reg_operand" "")
10349 (plus:SI (match_dup 1)
10351 (clobber (match_scratch:CC 3 ""))
10352 (clobber (match_scratch:SI 4 ""))]
10354 [(parallel [(set (match_dup 3)
10355 (compare:CC (plus:SI (match_dup 1)
10359 (plus:SI (match_dup 1)
10361 (set (pc) (if_then_else (match_dup 7)
10365 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
10370 (if_then_else (match_operator 2 "comparison_operator"
10371 [(match_operand:SI 1 "gpc_reg_operand" "")
10373 (match_operand 5 "" "")
10374 (match_operand 6 "" "")))
10375 (set (match_operand:SI 0 "general_operand" "")
10376 (plus:SI (match_dup 1) (const_int -1)))
10377 (clobber (match_scratch:CC 3 ""))
10378 (clobber (match_scratch:SI 4 ""))]
10379 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
10380 [(parallel [(set (match_dup 3)
10381 (compare:CC (plus:SI (match_dup 1)
10385 (plus:SI (match_dup 1)
10389 (set (pc) (if_then_else (match_dup 7)
10393 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
10396 (define_insn "trap"
10397 [(trap_if (const_int 1) (const_int 0))]
10401 (define_expand "conditional_trap"
10402 [(trap_if (match_operator 0 "trap_comparison_operator"
10403 [(match_dup 2) (match_dup 3)])
10404 (match_operand 1 "const_int_operand" ""))]
10406 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
10407 operands[2] = rs6000_compare_op0;
10408 operands[3] = rs6000_compare_op1;")
10411 [(trap_if (match_operator 0 "trap_comparison_operator"
10412 [(match_operand:SI 1 "register_operand" "r")
10413 (match_operand:SI 2 "reg_or_short_operand" "rI")])