7b2cd6e7163a721aeb675491278279587f9624ea
[gcc.git] / gcc / config / rs6000 / rs6000.md
1 ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 ;; 1999, 2000, 2001 Free Software Foundation, Inc.
4 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
5
6 ;; This file is part of GNU CC.
7
8 ;; GNU CC is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 2, or (at your option)
11 ;; any later version.
12
13 ;; GNU CC is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
17
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GNU CC; see the file COPYING. If not, write to
20 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
21 ;; Boston, MA 02111-1307, USA.
22
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
24
25 ;; `unspec' values used in rs6000.md:
26 ;; Number Use
27 ;; 0 frsp for POWER machines
28 ;; 0/v blockage
29 ;; 5 used to tie the stack contents and the stack pointer
30 ;; 6 address of a word pointing to the TOC
31 ;; 7 address of the TOC (more-or-less)
32 ;; 8 movsi_got
33 ;; 9/v eh_reg_restore
34 ;; 10 fctiwz
35 ;; 19 movesi_from_cr
36 ;; 20 movesi_to_cr
37 \f
38 ;; Define an insn type attribute. This is used in function unit delay
39 ;; computations.
40 (define_attr "type" "integer,load,store,fpload,fpstore,vecload,vecstore,imul,imul2,imul3,lmul,idiv,ldiv,branch,compare,cr_logical,delayed_compare,fpcompare,mtjmpr,fp,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg,vecsimple,veccomplex,veccmp,vecperm,vecfloat,altivec"
41 (const_string "integer"))
42
43 ;; Length (in bytes).
44 ; '(pc)' in the following doesn't include the instruction itself; it is
45 ; calculated as if the instruction had zero size.
46 (define_attr "length" ""
47 (if_then_else (eq_attr "type" "branch")
48 (if_then_else (and (ge (minus (match_dup 0) (pc))
49 (const_int -32768))
50 (lt (minus (match_dup 0) (pc))
51 (const_int 32764)))
52 (const_int 4)
53 (const_int 8))
54 (const_int 4)))
55
56 ;; Processor type -- this attribute must exactly match the processor_type
57 ;; enumeration in rs6000.h.
58
59 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450"
60 (const (symbol_ref "rs6000_cpu_attr")))
61
62 ; (define_function_unit NAME MULTIPLICITY SIMULTANEITY
63 ; TEST READY-DELAY ISSUE-DELAY [CONFLICT-LIST])
64
65 ; Load/Store Unit -- pure PowerPC only
66 ; (POWER and 601 use Integer Unit)
67 (define_function_unit "lsu" 1 0
68 (and (eq_attr "type" "load")
69 (eq_attr "cpu" "rs64a,mpccore,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400"))
70 2 1)
71
72 (define_function_unit "lsu" 1 0
73 (and (eq_attr "type" "load,vecload")
74 (eq_attr "cpu" "ppc7450"))
75 3 1)
76
77 (define_function_unit "lsu" 1 0
78 (and (eq_attr "type" "store,fpstore")
79 (eq_attr "cpu" "rs64a,mpccore,ppc603,ppc604,ppc604e,ppc620,ppc630"))
80 1 1)
81
82 (define_function_unit "lsu" 1 0
83 (and (eq_attr "type" "store,fpstore")
84 (eq_attr "cpu" "ppc750,ppc7400"))
85 2 1)
86
87 (define_function_unit "lsu" 1 0
88 (and (eq_attr "type" "store,vecstore")
89 (eq_attr "cpu" "ppc7450"))
90 3 1)
91
92 (define_function_unit "lsu" 1 0
93 (and (eq_attr "type" "fpstore")
94 (eq_attr "cpu" "ppc7450"))
95 3 3)
96
97 (define_function_unit "lsu" 1 0
98 (and (eq_attr "type" "fpload")
99 (eq_attr "cpu" "mpccore,ppc603,ppc750,ppc7400"))
100 2 1)
101
102 (define_function_unit "lsu" 1 0
103 (and (eq_attr "type" "fpload")
104 (eq_attr "cpu" "ppc7450"))
105 4 1)
106
107 (define_function_unit "lsu" 1 0
108 (and (eq_attr "type" "fpload")
109 (eq_attr "cpu" "rs64a,ppc604,ppc604e,ppc620,ppc630"))
110 3 1)
111
112 (define_function_unit "iu" 1 0
113 (and (eq_attr "type" "load")
114 (eq_attr "cpu" "rios1,ppc403,ppc405,ppc601"))
115 2 1)
116
117 (define_function_unit "iu" 1 0
118 (and (eq_attr "type" "store,fpstore")
119 (eq_attr "cpu" "rios1,ppc403,ppc405,ppc601"))
120 1 1)
121
122 (define_function_unit "fpu" 1 0
123 (and (eq_attr "type" "fpstore")
124 (eq_attr "cpu" "rios1,ppc601"))
125 0 1)
126
127 (define_function_unit "iu" 1 0
128 (and (eq_attr "type" "fpload")
129 (eq_attr "cpu" "rios1"))
130 2 1)
131
132 (define_function_unit "iu" 1 0
133 (and (eq_attr "type" "fpload")
134 (eq_attr "cpu" "ppc601"))
135 3 1)
136
137 (define_function_unit "iu2" 2 0
138 (and (eq_attr "type" "load,fpload")
139 (eq_attr "cpu" "rios2"))
140 2 1)
141
142 (define_function_unit "iu2" 2 0
143 (and (eq_attr "type" "store,fpstore")
144 (eq_attr "cpu" "rios2"))
145 1 1)
146
147 ; Integer Unit (RIOS1, PPC601, PPC603, RS64a)
148 (define_function_unit "iu" 1 0
149 (and (eq_attr "type" "integer")
150 (eq_attr "cpu" "rios1,rs64a,mpccore,ppc403,ppc405,ppc601,ppc603"))
151 1 1)
152
153 (define_function_unit "iu" 1 0
154 (and (eq_attr "type" "cr_logical")
155 (eq_attr "cpu" "mpccore,ppc403,ppc405,ppc601"))
156 1 1)
157
158 (define_function_unit "iu" 1 0
159 (and (eq_attr "type" "imul,imul2,imul3")
160 (eq_attr "cpu" "ppc403"))
161 4 4)
162
163 (define_function_unit "iu" 1 0
164 (and (eq_attr "type" "imul")
165 (eq_attr "cpu" "ppc405"))
166 4 3)
167
168 (define_function_unit "iu" 1 0
169 (and (eq_attr "type" "imul2,imul3")
170 (eq_attr "cpu" "ppc405"))
171 3 2)
172
173 (define_function_unit "iu" 1 0
174 (and (eq_attr "type" "imul")
175 (eq_attr "cpu" "rios1"))
176 5 5)
177
178 (define_function_unit "iu" 1 0
179 (and (eq_attr "type" "imul2")
180 (eq_attr "cpu" "rios1"))
181 4 4)
182
183 (define_function_unit "iu" 1 0
184 (and (eq_attr "type" "imul3")
185 (eq_attr "cpu" "rios1"))
186 3 3)
187
188 (define_function_unit "iu" 1 0
189 (and (eq_attr "type" "imul,imul2,imul3")
190 (eq_attr "cpu" "ppc601,ppc603"))
191 5 5)
192
193 (define_function_unit "iu" 1 0
194 (and (eq_attr "type" "imul")
195 (eq_attr "cpu" "rs64a"))
196 20 20)
197
198 (define_function_unit "iu" 1 0
199 (and (eq_attr "type" "imul2")
200 (eq_attr "cpu" "rs64a"))
201 12 12)
202
203 (define_function_unit "iu" 1 0
204 (and (eq_attr "type" "imul3")
205 (eq_attr "cpu" "rs64a"))
206 8 8)
207
208 (define_function_unit "iu" 1 0
209 (and (eq_attr "type" "lmul")
210 (eq_attr "cpu" "rs64a"))
211 34 34)
212
213 (define_function_unit "iu" 1 0
214 (and (eq_attr "type" "idiv")
215 (eq_attr "cpu" "rios1"))
216 19 19)
217
218 (define_function_unit "iu" 1 0
219 (and (eq_attr "type" "idiv")
220 (eq_attr "cpu" "rs64a"))
221 66 66)
222
223 (define_function_unit "iu" 1 0
224 (and (eq_attr "type" "ldiv")
225 (eq_attr "cpu" "rs64a"))
226 66 66)
227
228 (define_function_unit "iu" 1 0
229 (and (eq_attr "type" "idiv")
230 (eq_attr "cpu" "ppc403"))
231 33 33)
232
233 (define_function_unit "iu" 1 0
234 (and (eq_attr "type" "idiv")
235 (eq_attr "cpu" "ppc405"))
236 35 35)
237
238 (define_function_unit "iu" 1 0
239 (and (eq_attr "type" "idiv")
240 (eq_attr "cpu" "ppc601"))
241 36 36)
242
243 (define_function_unit "iu" 1 0
244 (and (eq_attr "type" "idiv")
245 (eq_attr "cpu" "ppc603"))
246 37 36)
247
248 ; RIOS2 has two integer units: a primary one which can perform all
249 ; operations and a secondary one which is fed in lock step with the first
250 ; and can perform "simple" integer operations.
251 ; To catch this we define a 'dummy' imuldiv-unit that is also needed
252 ; for the complex insns.
253 (define_function_unit "iu2" 2 0
254 (and (eq_attr "type" "integer")
255 (eq_attr "cpu" "rios2"))
256 1 1)
257
258 (define_function_unit "iu2" 2 0
259 (and (eq_attr "type" "imul,imul2,imul3")
260 (eq_attr "cpu" "rios2"))
261 2 2)
262
263 (define_function_unit "iu2" 2 0
264 (and (eq_attr "type" "idiv")
265 (eq_attr "cpu" "rios2"))
266 13 13)
267
268 (define_function_unit "imuldiv" 1 0
269 (and (eq_attr "type" "imul,imul2,imul3")
270 (eq_attr "cpu" "rios2"))
271 2 2)
272
273 (define_function_unit "imuldiv" 1 0
274 (and (eq_attr "type" "idiv")
275 (eq_attr "cpu" "rios2"))
276 13 13)
277
278 ; MPCCORE has separate IMUL/IDIV unit for multicycle instructions
279 ; Divide latency varies greatly from 2-11, use 6 as average
280 (define_function_unit "imuldiv" 1 0
281 (and (eq_attr "type" "imul,imul2,imul3")
282 (eq_attr "cpu" "mpccore"))
283 2 1)
284
285 (define_function_unit "imuldiv" 1 0
286 (and (eq_attr "type" "idiv")
287 (eq_attr "cpu" "mpccore"))
288 6 6)
289
290 ; PPC604{,e} has two units that perform integer operations
291 ; and one unit for divide/multiply operations (and move
292 ; from/to spr).
293 (define_function_unit "iu2" 2 0
294 (and (eq_attr "type" "integer")
295 (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630"))
296 1 1)
297
298 (define_function_unit "imuldiv" 1 0
299 (and (eq_attr "type" "imul,imul2,imul3")
300 (eq_attr "cpu" "ppc604"))
301 4 2)
302
303 (define_function_unit "imuldiv" 1 0
304 (and (eq_attr "type" "imul,imul2,imul3")
305 (eq_attr "cpu" "ppc604e"))
306 2 1)
307
308 (define_function_unit "imuldiv" 1 0
309 (and (eq_attr "type" "imul")
310 (eq_attr "cpu" "ppc620,ppc630"))
311 5 3)
312
313 (define_function_unit "imuldiv" 1 0
314 (and (eq_attr "type" "imul2")
315 (eq_attr "cpu" "ppc620,ppc630"))
316 4 3)
317
318 (define_function_unit "imuldiv" 1 0
319 (and (eq_attr "type" "imul3")
320 (eq_attr "cpu" "ppc620,ppc630"))
321 3 3)
322
323 (define_function_unit "imuldiv" 1 0
324 (and (eq_attr "type" "lmul")
325 (eq_attr "cpu" "ppc620,ppc630"))
326 7 5)
327
328 (define_function_unit "imuldiv" 1 0
329 (and (eq_attr "type" "idiv")
330 (eq_attr "cpu" "ppc604,ppc604e"))
331 20 19)
332
333 (define_function_unit "imuldiv" 1 0
334 (and (eq_attr "type" "idiv")
335 (eq_attr "cpu" "ppc620"))
336 37 36)
337
338 (define_function_unit "imuldiv" 1 0
339 (and (eq_attr "type" "idiv")
340 (eq_attr "cpu" "ppc630"))
341 21 20)
342
343 (define_function_unit "imuldiv" 1 0
344 (and (eq_attr "type" "ldiv")
345 (eq_attr "cpu" "ppc620,ppc630"))
346 37 36)
347
348 ; PPC7450 has 3 integer units (for most integer insns) and one mul/div
349 ; unit, which also does CR-logical insns and move to/from SPR.
350 ; It also has 4 vector units, one for each type of vector instruction.
351 ; However, we can only dispatch 2 instructions per cycle.
352 ; We model this as saying that dispatching two of the same type of instruction
353 ; in a row incurs a single cycle delay.
354 (define_function_unit "iu3" 3 0
355 (and (eq_attr "type" "integer")
356 (eq_attr "cpu" "ppc7450"))
357 1 1)
358
359 (define_function_unit "imuldiv" 1 0
360 (and (eq_attr "type" "imul")
361 (eq_attr "cpu" "ppc7450"))
362 4 2)
363
364 (define_function_unit "imuldiv" 1 0
365 (and (eq_attr "type" "imul2,imul3")
366 (eq_attr "cpu" "ppc7450"))
367 3 1)
368
369 (define_function_unit "imuldiv" 1 0
370 (and (eq_attr "type" "idiv")
371 (eq_attr "cpu" "ppc7450"))
372 23 23)
373
374 (define_function_unit "imuldiv" 1 0
375 (and (eq_attr "type" "cr_logical")
376 (eq_attr "cpu" "ppc7450"))
377 1 1)
378 (define_function_unit "vec_alu2" 2 0
379 (and (eq_attr "type" "vecsimple")
380 (eq_attr "cpu" "ppc7450"))
381 1 2 [(eq_attr "type" "vecsimple")])
382 (define_function_unit "vec_alu2" 2 0
383 (and (eq_attr "type" "vecsimple")
384 (eq_attr "cpu" "ppc7450"))
385 1 1 [(eq_attr "type" "!vecsimple")])
386 (define_function_unit "vec_alu2" 2 0
387 (and (eq_attr "type" "veccomplex")
388 (eq_attr "cpu" "ppc7450"))
389 4 2 [(eq_attr "type" "veccomplex")])
390 (define_function_unit "vec_alu2" 2 0
391 (and (eq_attr "type" "veccomplex")
392 (eq_attr "cpu" "ppc7450"))
393 4 1 [(eq_attr "type" "!veccomplex")])
394 (define_function_unit "vec_alu2" 2 0
395 (and (eq_attr "type" "veccmp")
396 (eq_attr "cpu" "ppc7450"))
397 2 2 [(eq_attr "type" "veccmp")])
398 (define_function_unit "vec_alu2" 2 0
399 (and (eq_attr "type" "veccmp")
400 (eq_attr "cpu" "ppc7450"))
401 2 1 [(eq_attr "type" "!veccmp")])
402 (define_function_unit "vec_alu2" 2 0
403 (and (eq_attr "type" "vecfloat")
404 (eq_attr "cpu" "ppc7450"))
405 4 2 [(eq_attr "type" "vecfloat")])
406 (define_function_unit "vec_alu2" 2 0
407 (and (eq_attr "type" "vecfloat")
408 (eq_attr "cpu" "ppc7450"))
409 4 1 [(eq_attr "type" "!vecfloat")])
410 (define_function_unit "vec_alu2" 2 0
411 (and (eq_attr "type" "vecperm")
412 (eq_attr "cpu" "ppc7450"))
413 2 2 [(eq_attr "type" "vecperm")])
414 (define_function_unit "vec_alu2" 2 0
415 (and (eq_attr "type" "vecperm")
416 (eq_attr "cpu" "ppc7450"))
417 2 1 [(eq_attr "type" "!vecperm")])
418
419 ; PPC750 has two integer units: a primary one which can perform all
420 ; operations and a secondary one which is fed in lock step with the first
421 ; and can perform "simple" integer operations.
422 ; To catch this we define a 'dummy' imuldiv-unit that is also needed
423 ; for the complex insns.
424 (define_function_unit "iu2" 2 0
425 (and (eq_attr "type" "integer")
426 (eq_attr "cpu" "ppc750,ppc7400"))
427 1 1)
428
429 (define_function_unit "iu2" 2 0
430 (and (eq_attr "type" "imul")
431 (eq_attr "cpu" "ppc750,ppc7400"))
432 4 4)
433
434 (define_function_unit "iu2" 2 0
435 (and (eq_attr "type" "imul2")
436 (eq_attr "cpu" "ppc750,ppc7400"))
437 3 2)
438
439 (define_function_unit "iu2" 2 0
440 (and (eq_attr "type" "imul3")
441 (eq_attr "cpu" "ppc750,ppc7400"))
442 2 1)
443
444 (define_function_unit "iu2" 2 0
445 (and (eq_attr "type" "idiv")
446 (eq_attr "cpu" "ppc750,ppc7400"))
447 19 19)
448
449 (define_function_unit "imuldiv" 1 0
450 (and (eq_attr "type" "imul")
451 (eq_attr "cpu" "ppc750,ppc7400"))
452 4 4)
453
454 (define_function_unit "imuldiv" 1 0
455 (and (eq_attr "type" "imul2")
456 (eq_attr "cpu" "ppc750,ppc7400"))
457 3 2)
458
459 (define_function_unit "imuldiv" 1 0
460 (and (eq_attr "type" "imul3")
461 (eq_attr "cpu" "ppc750,ppc7400"))
462 2 1)
463
464 (define_function_unit "imuldiv" 1 0
465 (and (eq_attr "type" "idiv")
466 (eq_attr "cpu" "ppc750,ppc7400"))
467 19 19)
468
469 ; CR-logical operations are execute-serialized, that is they don't
470 ; start (and block the function unit) until all preceding operations
471 ; have finished. They don't block dispatch of other insns, though.
472 ; I've imitated this by giving them longer latency.
473 (define_function_unit "sru" 1 0
474 (and (eq_attr "type" "cr_logical")
475 (eq_attr "cpu" "ppc603,ppc750,ppc7400"))
476 3 2)
477
478 ; compare is done on integer unit, but feeds insns which
479 ; execute on the branch unit.
480 (define_function_unit "iu" 1 0
481 (and (eq_attr "type" "compare")
482 (eq_attr "cpu" "rios1"))
483 4 1)
484
485 (define_function_unit "iu" 1 0
486 (and (eq_attr "type" "delayed_compare")
487 (eq_attr "cpu" "rios1"))
488 5 1)
489
490 (define_function_unit "iu" 1 0
491 (and (eq_attr "type" "compare,delayed_compare")
492 (eq_attr "cpu" "rs64a,mpccore,ppc403,ppc405,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630"))
493 3 1)
494
495 ; some extra cycles added by TARGET_SCHED_ADJUST_COST between compare
496 ; and a following branch, to reduce mispredicts
497 (define_function_unit "iu3" 3 0
498 (and (eq_attr "type" "compare,delayed_compare")
499 (eq_attr "cpu" "ppc7450"))
500 1 1)
501
502 (define_function_unit "iu2" 2 0
503 (and (eq_attr "type" "compare,delayed_compare")
504 (eq_attr "cpu" "rios2"))
505 3 1)
506
507 (define_function_unit "iu2" 2 0
508 (and (eq_attr "type" "compare,delayed_compare")
509 (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400"))
510 1 1)
511
512 ; fp compare uses fp unit
513 (define_function_unit "fpu" 1 0
514 (and (eq_attr "type" "fpcompare")
515 (eq_attr "cpu" "rios1"))
516 9 1)
517
518 ; rios1 and rios2 have different fpcompare delays
519 (define_function_unit "fpu2" 2 0
520 (and (eq_attr "type" "fpcompare")
521 (eq_attr "cpu" "rios2,ppc630"))
522 5 1)
523
524 ; on ppc601 and ppc603, fpcompare takes also 2 cycles from
525 ; the integer unit
526 ; here we do not define delays, just occupy the unit. The dependencies
527 ; will be assigned by the fpcompare definition in the fpu.
528 (define_function_unit "iu" 1 0
529 (and (eq_attr "type" "fpcompare")
530 (eq_attr "cpu" "ppc601,ppc603"))
531 0 2)
532
533 ; fp compare uses fp unit
534 (define_function_unit "fpu" 1 0
535 (and (eq_attr "type" "fpcompare")
536 (eq_attr "cpu" "rs64a,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630"))
537 5 1)
538
539 (define_function_unit "fpu" 1 0
540 (and (eq_attr "type" "fpcompare")
541 (eq_attr "cpu" "ppc750,ppc7400,ppc7450"))
542 3 1)
543
544 (define_function_unit "fpu" 1 0
545 (and (eq_attr "type" "fpcompare")
546 (eq_attr "cpu" "mpccore"))
547 1 1)
548
549 (define_function_unit "bpu" 1 0
550 (and (eq_attr "type" "mtjmpr")
551 (eq_attr "cpu" "rios1,rios2,rs64a"))
552 5 1)
553
554 (define_function_unit "bpu" 1 0
555 (and (eq_attr "type" "mtjmpr")
556 (eq_attr "cpu" "mpccore,ppc403,ppc405,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630"))
557 4 1)
558
559 (define_function_unit "sru" 1 0
560 (and (eq_attr "type" "mtjmpr")
561 (eq_attr "cpu" "ppc750,ppc7400"))
562 2 2)
563
564 (define_function_unit "imuldiv" 1 0
565 (and (eq_attr "type" "mtjmpr")
566 (eq_attr "cpu" "ppc7450"))
567 2 2)
568
569 (define_function_unit "bpu" 1 0
570 (and (eq_attr "type" "cr_logical")
571 (eq_attr "cpu" "rios1,rios2,ppc604"))
572 4 1)
573
574 (define_function_unit "cru" 1 0
575 (and (eq_attr "type" "cr_logical")
576 (eq_attr "cpu" "ppc604e,ppc620,ppc630,rs64a"))
577 1 1)
578
579 ; all jumps/branches are executing on the bpu, in 1 cycle, for all machines.
580 (define_function_unit "bpu" 1 0
581 (eq_attr "type" "jmpreg")
582 1 1)
583
584 (define_function_unit "bpu" 1 0
585 (eq_attr "type" "branch")
586 1 1)
587
588 ; Floating Point Unit
589 (define_function_unit "fpu" 1 0
590 (and (eq_attr "type" "fp,dmul")
591 (eq_attr "cpu" "rios1"))
592 2 1)
593
594 (define_function_unit "fpu" 1 0
595 (and (eq_attr "type" "fp")
596 (eq_attr "cpu" "rs64a,mpccore"))
597 4 2)
598
599 (define_function_unit "fpu" 1 0
600 (and (eq_attr "type" "fp")
601 (eq_attr "cpu" "ppc601"))
602 4 1)
603
604 (define_function_unit "fpu" 1 0
605 (and (eq_attr "type" "fp")
606 (eq_attr "cpu" "ppc603,ppc604,ppc604e,ppc620,ppc750,ppc7400"))
607 3 1)
608
609 (define_function_unit "fpu" 1 0
610 (and (eq_attr "type" "fp,dmul")
611 (eq_attr "cpu" "ppc7450"))
612 5 1)
613
614 (define_function_unit "fpu" 1 0
615 (and (eq_attr "type" "dmul")
616 (eq_attr "cpu" "rs64a"))
617 7 2)
618
619 (define_function_unit "fpu" 1 0
620 (and (eq_attr "type" "dmul")
621 (eq_attr "cpu" "mpccore"))
622 5 5)
623
624 (define_function_unit "fpu" 1 0
625 (and (eq_attr "type" "dmul")
626 (eq_attr "cpu" "ppc601"))
627 5 2)
628
629 ; is this true?
630 (define_function_unit "fpu" 1 0
631 (and (eq_attr "type" "dmul")
632 (eq_attr "cpu" "ppc603,ppc750"))
633 4 2)
634
635 (define_function_unit "fpu" 1 0
636 (and (eq_attr "type" "dmul")
637 (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc7400"))
638 3 1)
639
640 (define_function_unit "fpu" 1 0
641 (and (eq_attr "type" "sdiv,ddiv")
642 (eq_attr "cpu" "rios1"))
643 19 19)
644
645 (define_function_unit "fpu" 1 0
646 (and (eq_attr "type" "sdiv")
647 (eq_attr "cpu" "rs64a"))
648 31 31)
649
650 (define_function_unit "fpu" 1 0
651 (and (eq_attr "type" "sdiv")
652 (eq_attr "cpu" "ppc601,ppc750,ppc7400"))
653 17 17)
654
655 (define_function_unit "fpu" 1 0
656 (and (eq_attr "type" "sdiv")
657 (eq_attr "cpu" "ppc7450"))
658 21 21)
659
660 (define_function_unit "fpu" 1 0
661 (and (eq_attr "type" "sdiv")
662 (eq_attr "cpu" "mpccore"))
663 10 10)
664
665 (define_function_unit "fpu" 1 0
666 (and (eq_attr "type" "sdiv")
667 (eq_attr "cpu" "ppc603,ppc604,ppc604e,ppc620"))
668 18 18)
669
670 (define_function_unit "fpu" 1 0
671 (and (eq_attr "type" "ddiv")
672 (eq_attr "cpu" "mpccore"))
673 17 17)
674
675 (define_function_unit "fpu" 1 0
676 (and (eq_attr "type" "ddiv")
677 (eq_attr "cpu" "rs64a,ppc601,ppc750,ppc604,ppc604e,ppc620,ppc7400"))
678 31 31)
679
680 (define_function_unit "fpu" 1 0
681 (and (eq_attr "type" "ddiv")
682 (eq_attr "cpu" "ppc7450"))
683 35 35)
684
685 (define_function_unit "fpu" 1 0
686 (and (eq_attr "type" "ddiv")
687 (eq_attr "cpu" "ppc603"))
688 33 33)
689
690 (define_function_unit "fpu" 1 0
691 (and (eq_attr "type" "ssqrt")
692 (eq_attr "cpu" "ppc620"))
693 31 31)
694
695 (define_function_unit "fpu" 1 0
696 (and (eq_attr "type" "dsqrt")
697 (eq_attr "cpu" "ppc620"))
698 31 31)
699
700 ; RIOS2 has two symmetric FPUs.
701 (define_function_unit "fpu2" 2 0
702 (and (eq_attr "type" "fp")
703 (eq_attr "cpu" "rios2"))
704 2 1)
705
706 (define_function_unit "fpu2" 2 0
707 (and (eq_attr "type" "fp")
708 (eq_attr "cpu" "ppc630"))
709 3 1)
710
711 (define_function_unit "fpu2" 2 0
712 (and (eq_attr "type" "dmul")
713 (eq_attr "cpu" "rios2"))
714 2 1)
715
716 (define_function_unit "fpu2" 2 0
717 (and (eq_attr "type" "dmul")
718 (eq_attr "cpu" "ppc630"))
719 3 1)
720
721 (define_function_unit "fpu2" 2 0
722 (and (eq_attr "type" "sdiv,ddiv")
723 (eq_attr "cpu" "rios2"))
724 17 17)
725
726 (define_function_unit "fpu2" 2 0
727 (and (eq_attr "type" "sdiv")
728 (eq_attr "cpu" "ppc630"))
729 17 17)
730
731 (define_function_unit "fpu2" 2 0
732 (and (eq_attr "type" "ddiv")
733 (eq_attr "cpu" "ppc630"))
734 21 21)
735
736 (define_function_unit "fpu2" 2 0
737 (and (eq_attr "type" "ssqrt,dsqrt")
738 (eq_attr "cpu" "rios2"))
739 26 26)
740
741 (define_function_unit "fpu2" 2 0
742 (and (eq_attr "type" "ssqrt")
743 (eq_attr "cpu" "ppc630"))
744 18 18)
745
746 (define_function_unit "fpu2" 2 0
747 (and (eq_attr "type" "dsqrt")
748 (eq_attr "cpu" "ppc630"))
749 26 26)
750
751 \f
752 ;; Start with fixed-point load and store insns. Here we put only the more
753 ;; complex forms. Basic data transfer is done later.
754
755 (define_expand "zero_extendqidi2"
756 [(set (match_operand:DI 0 "gpc_reg_operand" "")
757 (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "")))]
758 "TARGET_POWERPC64"
759 "")
760
761 (define_insn ""
762 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
763 (zero_extend:DI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
764 "TARGET_POWERPC64"
765 "@
766 lbz%U1%X1 %0,%1
767 rldicl %0,%1,0,56"
768 [(set_attr "type" "load,*")])
769
770 (define_insn ""
771 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
772 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
773 (const_int 0)))
774 (clobber (match_scratch:DI 2 "=r,r"))]
775 "TARGET_POWERPC64"
776 "@
777 rldicl. %2,%1,0,56
778 #"
779 [(set_attr "type" "compare")
780 (set_attr "length" "4,8")])
781
782 (define_split
783 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
784 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
785 (const_int 0)))
786 (clobber (match_scratch:DI 2 ""))]
787 "TARGET_POWERPC64 && reload_completed"
788 [(set (match_dup 2)
789 (zero_extend:DI (match_dup 1)))
790 (set (match_dup 0)
791 (compare:CC (match_dup 2)
792 (const_int 0)))]
793 "")
794
795 (define_insn ""
796 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
797 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
798 (const_int 0)))
799 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
800 (zero_extend:DI (match_dup 1)))]
801 "TARGET_POWERPC64"
802 "@
803 rldicl. %0,%1,0,56
804 #"
805 [(set_attr "type" "compare")
806 (set_attr "length" "4,8")])
807
808 (define_split
809 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
810 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
811 (const_int 0)))
812 (set (match_operand:DI 0 "gpc_reg_operand" "")
813 (zero_extend:DI (match_dup 1)))]
814 "TARGET_POWERPC64 && reload_completed"
815 [(set (match_dup 0)
816 (zero_extend:DI (match_dup 1)))
817 (set (match_dup 2)
818 (compare:CC (match_dup 0)
819 (const_int 0)))]
820 "")
821
822 (define_insn "extendqidi2"
823 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
824 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
825 "TARGET_POWERPC64"
826 "extsb %0,%1")
827
828 (define_insn ""
829 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
830 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
831 (const_int 0)))
832 (clobber (match_scratch:DI 2 "=r,r"))]
833 "TARGET_POWERPC64"
834 "@
835 extsb. %2,%1
836 #"
837 [(set_attr "type" "compare")
838 (set_attr "length" "4,8")])
839
840 (define_split
841 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
842 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
843 (const_int 0)))
844 (clobber (match_scratch:DI 2 ""))]
845 "TARGET_POWERPC64 && reload_completed"
846 [(set (match_dup 2)
847 (sign_extend:DI (match_dup 1)))
848 (set (match_dup 0)
849 (compare:CC (match_dup 2)
850 (const_int 0)))]
851 "")
852
853 (define_insn ""
854 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
855 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
856 (const_int 0)))
857 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
858 (sign_extend:DI (match_dup 1)))]
859 "TARGET_POWERPC64"
860 "@
861 extsb. %0,%1
862 #"
863 [(set_attr "type" "compare")
864 (set_attr "length" "4,8")])
865
866 (define_split
867 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
868 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
869 (const_int 0)))
870 (set (match_operand:DI 0 "gpc_reg_operand" "")
871 (sign_extend:DI (match_dup 1)))]
872 "TARGET_POWERPC64 && reload_completed"
873 [(set (match_dup 0)
874 (sign_extend:DI (match_dup 1)))
875 (set (match_dup 2)
876 (compare:CC (match_dup 0)
877 (const_int 0)))]
878 "")
879
880 (define_expand "zero_extendhidi2"
881 [(set (match_operand:DI 0 "gpc_reg_operand" "")
882 (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
883 "TARGET_POWERPC64"
884 "")
885
886 (define_insn ""
887 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
888 (zero_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
889 "TARGET_POWERPC64"
890 "@
891 lhz%U1%X1 %0,%1
892 rldicl %0,%1,0,48"
893 [(set_attr "type" "load,*")])
894
895 (define_insn ""
896 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
897 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
898 (const_int 0)))
899 (clobber (match_scratch:DI 2 "=r,r"))]
900 "TARGET_POWERPC64"
901 "@
902 rldicl. %2,%1,0,48
903 #"
904 [(set_attr "type" "compare")
905 (set_attr "length" "4,8")])
906
907 (define_split
908 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
909 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
910 (const_int 0)))
911 (clobber (match_scratch:DI 2 ""))]
912 "TARGET_POWERPC64 && reload_completed"
913 [(set (match_dup 2)
914 (zero_extend:DI (match_dup 1)))
915 (set (match_dup 0)
916 (compare:CC (match_dup 2)
917 (const_int 0)))]
918 "")
919
920 (define_insn ""
921 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
922 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
923 (const_int 0)))
924 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
925 (zero_extend:DI (match_dup 1)))]
926 "TARGET_POWERPC64"
927 "@
928 rldicl. %0,%1,0,48
929 #"
930 [(set_attr "type" "compare")
931 (set_attr "length" "4,8")])
932
933 (define_split
934 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
935 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
936 (const_int 0)))
937 (set (match_operand:DI 0 "gpc_reg_operand" "")
938 (zero_extend:DI (match_dup 1)))]
939 "TARGET_POWERPC64 && reload_completed"
940 [(set (match_dup 0)
941 (zero_extend:DI (match_dup 1)))
942 (set (match_dup 2)
943 (compare:CC (match_dup 0)
944 (const_int 0)))]
945 "")
946
947 (define_expand "extendhidi2"
948 [(set (match_operand:DI 0 "gpc_reg_operand" "")
949 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
950 "TARGET_POWERPC64"
951 "")
952
953 (define_insn ""
954 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
955 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
956 "TARGET_POWERPC64"
957 "@
958 lha%U1%X1 %0,%1
959 extsh %0,%1"
960 [(set_attr "type" "load,*")])
961
962 (define_insn ""
963 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
964 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
965 (const_int 0)))
966 (clobber (match_scratch:DI 2 "=r,r"))]
967 "TARGET_POWERPC64"
968 "@
969 extsh. %2,%1
970 #"
971 [(set_attr "type" "compare")
972 (set_attr "length" "4,8")])
973
974 (define_split
975 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
976 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
977 (const_int 0)))
978 (clobber (match_scratch:DI 2 ""))]
979 "TARGET_POWERPC64 && reload_completed"
980 [(set (match_dup 2)
981 (sign_extend:DI (match_dup 1)))
982 (set (match_dup 0)
983 (compare:CC (match_dup 2)
984 (const_int 0)))]
985 "")
986
987 (define_insn ""
988 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
989 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
990 (const_int 0)))
991 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
992 (sign_extend:DI (match_dup 1)))]
993 "TARGET_POWERPC64"
994 "@
995 extsh. %0,%1
996 #"
997 [(set_attr "type" "compare")
998 (set_attr "length" "4,8")])
999
1000 (define_split
1001 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1002 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
1003 (const_int 0)))
1004 (set (match_operand:DI 0 "gpc_reg_operand" "")
1005 (sign_extend:DI (match_dup 1)))]
1006 "TARGET_POWERPC64 && reload_completed"
1007 [(set (match_dup 0)
1008 (sign_extend:DI (match_dup 1)))
1009 (set (match_dup 2)
1010 (compare:CC (match_dup 0)
1011 (const_int 0)))]
1012 "")
1013
1014 (define_expand "zero_extendsidi2"
1015 [(set (match_operand:DI 0 "gpc_reg_operand" "")
1016 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
1017 "TARGET_POWERPC64"
1018 "")
1019
1020 (define_insn ""
1021 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
1022 (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r")))]
1023 "TARGET_POWERPC64"
1024 "@
1025 lwz%U1%X1 %0,%1
1026 rldicl %0,%1,0,32"
1027 [(set_attr "type" "load,*")])
1028
1029 (define_insn ""
1030 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1031 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1032 (const_int 0)))
1033 (clobber (match_scratch:DI 2 "=r,r"))]
1034 "TARGET_POWERPC64"
1035 "@
1036 rldicl. %2,%1,0,32
1037 #"
1038 [(set_attr "type" "compare")
1039 (set_attr "length" "4,8")])
1040
1041 (define_split
1042 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1043 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
1044 (const_int 0)))
1045 (clobber (match_scratch:DI 2 ""))]
1046 "TARGET_POWERPC64 && reload_completed"
1047 [(set (match_dup 2)
1048 (zero_extend:DI (match_dup 1)))
1049 (set (match_dup 0)
1050 (compare:CC (match_dup 2)
1051 (const_int 0)))]
1052 "")
1053
1054 (define_insn ""
1055 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1056 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1057 (const_int 0)))
1058 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
1059 (zero_extend:DI (match_dup 1)))]
1060 "TARGET_POWERPC64"
1061 "@
1062 rldicl. %0,%1,0,32
1063 #"
1064 [(set_attr "type" "compare")
1065 (set_attr "length" "4,8")])
1066
1067 (define_split
1068 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1069 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
1070 (const_int 0)))
1071 (set (match_operand:DI 0 "gpc_reg_operand" "")
1072 (zero_extend:DI (match_dup 1)))]
1073 "TARGET_POWERPC64 && reload_completed"
1074 [(set (match_dup 0)
1075 (zero_extend:DI (match_dup 1)))
1076 (set (match_dup 2)
1077 (compare:CC (match_dup 0)
1078 (const_int 0)))]
1079 "")
1080
1081 (define_expand "extendsidi2"
1082 [(set (match_operand:DI 0 "gpc_reg_operand" "")
1083 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
1084 "TARGET_POWERPC64"
1085 "")
1086
1087 (define_insn ""
1088 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
1089 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
1090 "TARGET_POWERPC64"
1091 "@
1092 lwa%U1%X1 %0,%1
1093 extsw %0,%1"
1094 [(set_attr "type" "load,*")])
1095
1096 (define_insn ""
1097 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1098 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1099 (const_int 0)))
1100 (clobber (match_scratch:DI 2 "=r,r"))]
1101 "TARGET_POWERPC64"
1102 "@
1103 extsw. %2,%1
1104 #"
1105 [(set_attr "type" "compare")
1106 (set_attr "length" "4,8")])
1107
1108 (define_split
1109 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1110 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
1111 (const_int 0)))
1112 (clobber (match_scratch:DI 2 ""))]
1113 "TARGET_POWERPC64 && reload_completed"
1114 [(set (match_dup 2)
1115 (sign_extend:DI (match_dup 1)))
1116 (set (match_dup 0)
1117 (compare:CC (match_dup 2)
1118 (const_int 0)))]
1119 "")
1120
1121 (define_insn ""
1122 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1123 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1124 (const_int 0)))
1125 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
1126 (sign_extend:DI (match_dup 1)))]
1127 "TARGET_POWERPC64"
1128 "@
1129 extsw. %0,%1
1130 #"
1131 [(set_attr "type" "compare")
1132 (set_attr "length" "4,8")])
1133
1134 (define_split
1135 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1136 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
1137 (const_int 0)))
1138 (set (match_operand:DI 0 "gpc_reg_operand" "")
1139 (sign_extend:DI (match_dup 1)))]
1140 "TARGET_POWERPC64 && reload_completed"
1141 [(set (match_dup 0)
1142 (sign_extend:DI (match_dup 1)))
1143 (set (match_dup 2)
1144 (compare:CC (match_dup 0)
1145 (const_int 0)))]
1146 "")
1147
1148 (define_expand "zero_extendqisi2"
1149 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1150 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
1151 ""
1152 "")
1153
1154 (define_insn ""
1155 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1156 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
1157 ""
1158 "@
1159 lbz%U1%X1 %0,%1
1160 {rlinm|rlwinm} %0,%1,0,0xff"
1161 [(set_attr "type" "load,*")])
1162
1163 (define_insn ""
1164 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1165 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1166 (const_int 0)))
1167 (clobber (match_scratch:SI 2 "=r,r"))]
1168 ""
1169 "@
1170 {andil.|andi.} %2,%1,0xff
1171 #"
1172 [(set_attr "type" "compare")
1173 (set_attr "length" "4,8")])
1174
1175 (define_split
1176 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1177 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
1178 (const_int 0)))
1179 (clobber (match_scratch:SI 2 ""))]
1180 "reload_completed"
1181 [(set (match_dup 2)
1182 (zero_extend:SI (match_dup 1)))
1183 (set (match_dup 0)
1184 (compare:CC (match_dup 2)
1185 (const_int 0)))]
1186 "")
1187
1188 (define_insn ""
1189 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1190 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1191 (const_int 0)))
1192 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1193 (zero_extend:SI (match_dup 1)))]
1194 ""
1195 "@
1196 {andil.|andi.} %0,%1,0xff
1197 #"
1198 [(set_attr "type" "compare")
1199 (set_attr "length" "4,8")])
1200
1201 (define_split
1202 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1203 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
1204 (const_int 0)))
1205 (set (match_operand:SI 0 "gpc_reg_operand" "")
1206 (zero_extend:SI (match_dup 1)))]
1207 "reload_completed"
1208 [(set (match_dup 0)
1209 (zero_extend:SI (match_dup 1)))
1210 (set (match_dup 2)
1211 (compare:CC (match_dup 0)
1212 (const_int 0)))]
1213 "")
1214
1215 (define_expand "extendqisi2"
1216 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1217 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
1218 ""
1219 "
1220 {
1221 if (TARGET_POWERPC)
1222 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
1223 else if (TARGET_POWER)
1224 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
1225 else
1226 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
1227 DONE;
1228 }")
1229
1230 (define_insn "extendqisi2_ppc"
1231 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1232 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
1233 "TARGET_POWERPC"
1234 "extsb %0,%1")
1235
1236 (define_insn ""
1237 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1238 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1239 (const_int 0)))
1240 (clobber (match_scratch:SI 2 "=r,r"))]
1241 "TARGET_POWERPC"
1242 "@
1243 extsb. %2,%1
1244 #"
1245 [(set_attr "type" "compare")
1246 (set_attr "length" "4,8")])
1247
1248 (define_split
1249 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1250 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
1251 (const_int 0)))
1252 (clobber (match_scratch:SI 2 ""))]
1253 "TARGET_POWERPC && reload_completed"
1254 [(set (match_dup 2)
1255 (sign_extend:SI (match_dup 1)))
1256 (set (match_dup 0)
1257 (compare:CC (match_dup 2)
1258 (const_int 0)))]
1259 "")
1260
1261 (define_insn ""
1262 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1263 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1264 (const_int 0)))
1265 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1266 (sign_extend:SI (match_dup 1)))]
1267 "TARGET_POWERPC"
1268 "@
1269 extsb. %0,%1
1270 #"
1271 [(set_attr "type" "compare")
1272 (set_attr "length" "4,8")])
1273
1274 (define_split
1275 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1276 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
1277 (const_int 0)))
1278 (set (match_operand:SI 0 "gpc_reg_operand" "")
1279 (sign_extend:SI (match_dup 1)))]
1280 "TARGET_POWERPC && reload_completed"
1281 [(set (match_dup 0)
1282 (sign_extend:SI (match_dup 1)))
1283 (set (match_dup 2)
1284 (compare:CC (match_dup 0)
1285 (const_int 0)))]
1286 "")
1287
1288 (define_expand "extendqisi2_power"
1289 [(parallel [(set (match_dup 2)
1290 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
1291 (const_int 24)))
1292 (clobber (scratch:SI))])
1293 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
1294 (ashiftrt:SI (match_dup 2)
1295 (const_int 24)))
1296 (clobber (scratch:SI))])]
1297 "TARGET_POWER"
1298 "
1299 { operands[1] = gen_lowpart (SImode, operands[1]);
1300 operands[2] = gen_reg_rtx (SImode); }")
1301
1302 (define_expand "extendqisi2_no_power"
1303 [(set (match_dup 2)
1304 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
1305 (const_int 24)))
1306 (set (match_operand:SI 0 "gpc_reg_operand" "")
1307 (ashiftrt:SI (match_dup 2)
1308 (const_int 24)))]
1309 "! TARGET_POWER && ! TARGET_POWERPC"
1310 "
1311 { operands[1] = gen_lowpart (SImode, operands[1]);
1312 operands[2] = gen_reg_rtx (SImode); }")
1313
1314 (define_expand "zero_extendqihi2"
1315 [(set (match_operand:HI 0 "gpc_reg_operand" "")
1316 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
1317 ""
1318 "")
1319
1320 (define_insn ""
1321 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
1322 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
1323 ""
1324 "@
1325 lbz%U1%X1 %0,%1
1326 {rlinm|rlwinm} %0,%1,0,0xff"
1327 [(set_attr "type" "load,*")])
1328
1329 (define_insn ""
1330 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1331 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1332 (const_int 0)))
1333 (clobber (match_scratch:HI 2 "=r,r"))]
1334 ""
1335 "@
1336 {andil.|andi.} %2,%1,0xff
1337 #"
1338 [(set_attr "type" "compare")
1339 (set_attr "length" "4,8")])
1340
1341 (define_split
1342 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1343 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1344 (const_int 0)))
1345 (clobber (match_scratch:HI 2 ""))]
1346 "reload_completed"
1347 [(set (match_dup 2)
1348 (zero_extend:HI (match_dup 1)))
1349 (set (match_dup 0)
1350 (compare:CC (match_dup 2)
1351 (const_int 0)))]
1352 "")
1353
1354 (define_insn ""
1355 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1356 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1357 (const_int 0)))
1358 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
1359 (zero_extend:HI (match_dup 1)))]
1360 ""
1361 "@
1362 {andil.|andi.} %0,%1,0xff
1363 #"
1364 [(set_attr "type" "compare")
1365 (set_attr "length" "4,8")])
1366
1367 (define_split
1368 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1369 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1370 (const_int 0)))
1371 (set (match_operand:HI 0 "gpc_reg_operand" "")
1372 (zero_extend:HI (match_dup 1)))]
1373 "reload_completed"
1374 [(set (match_dup 0)
1375 (zero_extend:HI (match_dup 1)))
1376 (set (match_dup 2)
1377 (compare:CC (match_dup 0)
1378 (const_int 0)))]
1379 "")
1380
1381 (define_expand "extendqihi2"
1382 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
1383 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
1384 ""
1385 "
1386 {
1387 if (TARGET_POWERPC)
1388 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
1389 else if (TARGET_POWER)
1390 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
1391 else
1392 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
1393 DONE;
1394 }")
1395
1396 (define_insn "extendqihi2_ppc"
1397 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
1398 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
1399 "TARGET_POWERPC"
1400 "extsb %0,%1")
1401
1402 (define_insn ""
1403 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1404 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1405 (const_int 0)))
1406 (clobber (match_scratch:HI 2 "=r,r"))]
1407 "TARGET_POWERPC"
1408 "@
1409 extsb. %2,%1
1410 #"
1411 [(set_attr "type" "compare")
1412 (set_attr "length" "4,8")])
1413
1414 (define_split
1415 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1416 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1417 (const_int 0)))
1418 (clobber (match_scratch:HI 2 ""))]
1419 "TARGET_POWERPC && reload_completed"
1420 [(set (match_dup 2)
1421 (sign_extend:HI (match_dup 1)))
1422 (set (match_dup 0)
1423 (compare:CC (match_dup 2)
1424 (const_int 0)))]
1425 "")
1426
1427 (define_insn ""
1428 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1429 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1430 (const_int 0)))
1431 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
1432 (sign_extend:HI (match_dup 1)))]
1433 "TARGET_POWERPC"
1434 "@
1435 extsb. %0,%1
1436 #"
1437 [(set_attr "type" "compare")
1438 (set_attr "length" "4,8")])
1439
1440 (define_split
1441 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1442 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1443 (const_int 0)))
1444 (set (match_operand:HI 0 "gpc_reg_operand" "")
1445 (sign_extend:HI (match_dup 1)))]
1446 "TARGET_POWERPC && reload_completed"
1447 [(set (match_dup 0)
1448 (sign_extend:HI (match_dup 1)))
1449 (set (match_dup 2)
1450 (compare:CC (match_dup 0)
1451 (const_int 0)))]
1452 "")
1453
1454 (define_expand "extendqihi2_power"
1455 [(parallel [(set (match_dup 2)
1456 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
1457 (const_int 24)))
1458 (clobber (scratch:SI))])
1459 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
1460 (ashiftrt:SI (match_dup 2)
1461 (const_int 24)))
1462 (clobber (scratch:SI))])]
1463 "TARGET_POWER"
1464 "
1465 { operands[0] = gen_lowpart (SImode, operands[0]);
1466 operands[1] = gen_lowpart (SImode, operands[1]);
1467 operands[2] = gen_reg_rtx (SImode); }")
1468
1469 (define_expand "extendqihi2_no_power"
1470 [(set (match_dup 2)
1471 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
1472 (const_int 24)))
1473 (set (match_operand:HI 0 "gpc_reg_operand" "")
1474 (ashiftrt:SI (match_dup 2)
1475 (const_int 24)))]
1476 "! TARGET_POWER && ! TARGET_POWERPC"
1477 "
1478 { operands[0] = gen_lowpart (SImode, operands[0]);
1479 operands[1] = gen_lowpart (SImode, operands[1]);
1480 operands[2] = gen_reg_rtx (SImode); }")
1481
1482 (define_expand "zero_extendhisi2"
1483 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1484 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
1485 ""
1486 "")
1487
1488 (define_insn ""
1489 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1490 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1491 ""
1492 "@
1493 lhz%U1%X1 %0,%1
1494 {rlinm|rlwinm} %0,%1,0,0xffff"
1495 [(set_attr "type" "load,*")])
1496
1497 (define_insn ""
1498 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1499 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1500 (const_int 0)))
1501 (clobber (match_scratch:SI 2 "=r,r"))]
1502 ""
1503 "@
1504 {andil.|andi.} %2,%1,0xffff
1505 #"
1506 [(set_attr "type" "compare")
1507 (set_attr "length" "4,8")])
1508
1509 (define_split
1510 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1511 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1512 (const_int 0)))
1513 (clobber (match_scratch:SI 2 ""))]
1514 "reload_completed"
1515 [(set (match_dup 2)
1516 (zero_extend:SI (match_dup 1)))
1517 (set (match_dup 0)
1518 (compare:CC (match_dup 2)
1519 (const_int 0)))]
1520 "")
1521
1522 (define_insn ""
1523 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1524 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1525 (const_int 0)))
1526 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1527 (zero_extend:SI (match_dup 1)))]
1528 ""
1529 "@
1530 {andil.|andi.} %0,%1,0xffff
1531 #"
1532 [(set_attr "type" "compare")
1533 (set_attr "length" "4,8")])
1534
1535 (define_split
1536 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1537 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1538 (const_int 0)))
1539 (set (match_operand:SI 0 "gpc_reg_operand" "")
1540 (zero_extend:SI (match_dup 1)))]
1541 "reload_completed"
1542 [(set (match_dup 0)
1543 (zero_extend:SI (match_dup 1)))
1544 (set (match_dup 2)
1545 (compare:CC (match_dup 0)
1546 (const_int 0)))]
1547 "")
1548
1549 (define_expand "extendhisi2"
1550 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1551 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
1552 ""
1553 "")
1554
1555 (define_insn ""
1556 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1557 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1558 ""
1559 "@
1560 lha%U1%X1 %0,%1
1561 {exts|extsh} %0,%1"
1562 [(set_attr "type" "load,*")])
1563
1564 (define_insn ""
1565 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1566 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1567 (const_int 0)))
1568 (clobber (match_scratch:SI 2 "=r,r"))]
1569 ""
1570 "@
1571 {exts.|extsh.} %2,%1
1572 #"
1573 [(set_attr "type" "compare")
1574 (set_attr "length" "4,8")])
1575
1576 (define_split
1577 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1578 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1579 (const_int 0)))
1580 (clobber (match_scratch:SI 2 ""))]
1581 "reload_completed"
1582 [(set (match_dup 2)
1583 (sign_extend:SI (match_dup 1)))
1584 (set (match_dup 0)
1585 (compare:CC (match_dup 2)
1586 (const_int 0)))]
1587 "")
1588
1589 (define_insn ""
1590 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1591 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1592 (const_int 0)))
1593 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1594 (sign_extend:SI (match_dup 1)))]
1595 ""
1596 "@
1597 {exts.|extsh.} %0,%1
1598 #"
1599 [(set_attr "type" "compare")
1600 (set_attr "length" "4,8")])
1601 \f
1602 (define_split
1603 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1604 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1605 (const_int 0)))
1606 (set (match_operand:SI 0 "gpc_reg_operand" "")
1607 (sign_extend:SI (match_dup 1)))]
1608 "reload_completed"
1609 [(set (match_dup 0)
1610 (sign_extend:SI (match_dup 1)))
1611 (set (match_dup 2)
1612 (compare:CC (match_dup 0)
1613 (const_int 0)))]
1614 "")
1615
1616 ;; Fixed-point arithmetic insns.
1617
1618 ;; Discourage ai/addic because of carry but provide it in an alternative
1619 ;; allowing register zero as source.
1620 (define_expand "addsi3"
1621 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1622 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1623 (match_operand:SI 2 "reg_or_arith_cint_operand" "")))]
1624 ""
1625 "
1626 {
1627 if (GET_CODE (operands[2]) == CONST_INT
1628 && ! add_operand (operands[2], SImode))
1629 {
1630 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
1631 ? operands[0] : gen_reg_rtx (SImode));
1632
1633 HOST_WIDE_INT val = INTVAL (operands[2]);
1634 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1635 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, SImode);
1636
1637 /* The ordering here is important for the prolog expander.
1638 When space is allocated from the stack, adding 'low' first may
1639 produce a temporary deallocation (which would be bad). */
1640 emit_insn (gen_addsi3 (tmp, operands[1], GEN_INT (rest)));
1641 emit_insn (gen_addsi3 (operands[0], tmp, GEN_INT (low)));
1642 DONE;
1643 }
1644 }")
1645
1646 (define_insn "*addsi3_internal1"
1647 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,?r,r")
1648 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,b,r,b")
1649 (match_operand:SI 2 "add_operand" "r,I,I,L")))]
1650 ""
1651 "@
1652 {cax|add} %0,%1,%2
1653 {cal %0,%2(%1)|addi %0,%1,%2}
1654 {ai|addic} %0,%1,%2
1655 {cau|addis} %0,%1,%v2"
1656 [(set_attr "length" "4,4,4,4")])
1657
1658 (define_insn "addsi3_high"
1659 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1660 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1661 (high:SI (match_operand 2 "" ""))))]
1662 "TARGET_MACHO && !TARGET_64BIT"
1663 "{cau|addis} %0,%1,ha16(%2)"
1664 [(set_attr "length" "4")])
1665
1666 (define_insn "*addsi3_internal2"
1667 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1668 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1669 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
1670 (const_int 0)))
1671 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
1672 "! TARGET_POWERPC64"
1673 "@
1674 {cax.|add.} %3,%1,%2
1675 {ai.|addic.} %3,%1,%2
1676 #
1677 #"
1678 [(set_attr "type" "compare")
1679 (set_attr "length" "4,4,8,8")])
1680
1681 (define_split
1682 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1683 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1684 (match_operand:SI 2 "reg_or_short_operand" ""))
1685 (const_int 0)))
1686 (clobber (match_scratch:SI 3 ""))]
1687 "! TARGET_POWERPC64 && reload_completed"
1688 [(set (match_dup 3)
1689 (plus:SI (match_dup 1)
1690 (match_dup 2)))
1691 (set (match_dup 0)
1692 (compare:CC (match_dup 3)
1693 (const_int 0)))]
1694 "")
1695
1696 (define_insn "*addsi3_internal3"
1697 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1698 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1699 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
1700 (const_int 0)))
1701 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
1702 (plus:SI (match_dup 1)
1703 (match_dup 2)))]
1704 "! TARGET_POWERPC64"
1705 "@
1706 {cax.|add.} %0,%1,%2
1707 {ai.|addic.} %0,%1,%2
1708 #
1709 #"
1710 [(set_attr "type" "compare")
1711 (set_attr "length" "4,4,8,8")])
1712
1713 (define_split
1714 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1715 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1716 (match_operand:SI 2 "reg_or_short_operand" ""))
1717 (const_int 0)))
1718 (set (match_operand:SI 0 "gpc_reg_operand" "")
1719 (plus:SI (match_dup 1) (match_dup 2)))]
1720 "! TARGET_POWERPC64 && reload_completed"
1721 [(set (match_dup 0)
1722 (plus:SI (match_dup 1)
1723 (match_dup 2)))
1724 (set (match_dup 3)
1725 (compare:CC (match_dup 0)
1726 (const_int 0)))]
1727 "")
1728
1729 ;; Split an add that we can't do in one insn into two insns, each of which
1730 ;; does one 16-bit part. This is used by combine. Note that the low-order
1731 ;; add should be last in case the result gets used in an address.
1732
1733 (define_split
1734 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1735 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1736 (match_operand:SI 2 "non_add_cint_operand" "")))]
1737 ""
1738 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
1739 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
1740 "
1741 {
1742 HOST_WIDE_INT val = INTVAL (operands[2]);
1743 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1744 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, SImode);
1745
1746 operands[3] = GEN_INT (rest);
1747 operands[4] = GEN_INT (low);
1748 }")
1749
1750 (define_insn "one_cmplsi2"
1751 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1752 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1753 ""
1754 "nor %0,%1,%1")
1755
1756 (define_insn ""
1757 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1758 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1759 (const_int 0)))
1760 (clobber (match_scratch:SI 2 "=r,r"))]
1761 "! TARGET_POWERPC64"
1762 "@
1763 nor. %2,%1,%1
1764 #"
1765 [(set_attr "type" "compare")
1766 (set_attr "length" "4,8")])
1767
1768 (define_split
1769 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1770 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1771 (const_int 0)))
1772 (clobber (match_scratch:SI 2 ""))]
1773 "! TARGET_POWERPC64 && reload_completed"
1774 [(set (match_dup 2)
1775 (not:SI (match_dup 1)))
1776 (set (match_dup 0)
1777 (compare:CC (match_dup 2)
1778 (const_int 0)))]
1779 "")
1780
1781 (define_insn ""
1782 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1783 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1784 (const_int 0)))
1785 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1786 (not:SI (match_dup 1)))]
1787 "! TARGET_POWERPC64"
1788 "@
1789 nor. %0,%1,%1
1790 #"
1791 [(set_attr "type" "compare")
1792 (set_attr "length" "4,8")])
1793
1794 (define_split
1795 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1796 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1797 (const_int 0)))
1798 (set (match_operand:SI 0 "gpc_reg_operand" "")
1799 (not:SI (match_dup 1)))]
1800 "! TARGET_POWERPC64 && reload_completed"
1801 [(set (match_dup 0)
1802 (not:SI (match_dup 1)))
1803 (set (match_dup 2)
1804 (compare:CC (match_dup 0)
1805 (const_int 0)))]
1806 "")
1807
1808 (define_insn ""
1809 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1810 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1811 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1812 "! TARGET_POWERPC"
1813 "{sf%I1|subf%I1c} %0,%2,%1")
1814
1815 (define_insn ""
1816 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1817 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "r,I")
1818 (match_operand:SI 2 "gpc_reg_operand" "r,r")))]
1819 "TARGET_POWERPC"
1820 "@
1821 subf %0,%2,%1
1822 subfic %0,%2,%1")
1823
1824 (define_insn ""
1825 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1826 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1827 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1828 (const_int 0)))
1829 (clobber (match_scratch:SI 3 "=r,r"))]
1830 "! TARGET_POWERPC"
1831 "@
1832 {sf.|subfc.} %3,%2,%1
1833 #"
1834 [(set_attr "type" "compare")
1835 (set_attr "length" "4,8")])
1836
1837 (define_insn ""
1838 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1839 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1840 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1841 (const_int 0)))
1842 (clobber (match_scratch:SI 3 "=r,r"))]
1843 "TARGET_POWERPC && ! TARGET_POWERPC64"
1844 "@
1845 subf. %3,%2,%1
1846 #"
1847 [(set_attr "type" "compare")
1848 (set_attr "length" "4,8")])
1849
1850 (define_split
1851 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1852 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1853 (match_operand:SI 2 "gpc_reg_operand" ""))
1854 (const_int 0)))
1855 (clobber (match_scratch:SI 3 ""))]
1856 "! TARGET_POWERPC64 && reload_completed"
1857 [(set (match_dup 3)
1858 (minus:SI (match_dup 1)
1859 (match_dup 2)))
1860 (set (match_dup 0)
1861 (compare:CC (match_dup 3)
1862 (const_int 0)))]
1863 "")
1864
1865 (define_insn ""
1866 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1867 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1868 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1869 (const_int 0)))
1870 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1871 (minus:SI (match_dup 1) (match_dup 2)))]
1872 "! TARGET_POWERPC"
1873 "@
1874 {sf.|subfc.} %0,%2,%1
1875 #"
1876 [(set_attr "type" "compare")
1877 (set_attr "length" "4,8")])
1878
1879 (define_insn ""
1880 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1881 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1882 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1883 (const_int 0)))
1884 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1885 (minus:SI (match_dup 1)
1886 (match_dup 2)))]
1887 "TARGET_POWERPC && ! TARGET_POWERPC64"
1888 "@
1889 subf. %0,%2,%1
1890 #"
1891 [(set_attr "type" "compare")
1892 (set_attr "length" "4,8")])
1893
1894 (define_split
1895 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1896 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1897 (match_operand:SI 2 "gpc_reg_operand" ""))
1898 (const_int 0)))
1899 (set (match_operand:SI 0 "gpc_reg_operand" "")
1900 (minus:SI (match_dup 1)
1901 (match_dup 2)))]
1902 "! TARGET_POWERPC64 && reload_completed"
1903 [(set (match_dup 0)
1904 (minus:SI (match_dup 1)
1905 (match_dup 2)))
1906 (set (match_dup 3)
1907 (compare:CC (match_dup 0)
1908 (const_int 0)))]
1909 "")
1910
1911 (define_expand "subsi3"
1912 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1913 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "")
1914 (match_operand:SI 2 "reg_or_arith_cint_operand" "")))]
1915 ""
1916 "
1917 {
1918 if (GET_CODE (operands[2]) == CONST_INT)
1919 {
1920 emit_insn (gen_addsi3 (operands[0], operands[1],
1921 negate_rtx (SImode, operands[2])));
1922 DONE;
1923 }
1924 }")
1925
1926 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1927 ;; instruction and some auxiliary computations. Then we just have a single
1928 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1929 ;; combine.
1930
1931 (define_expand "sminsi3"
1932 [(set (match_dup 3)
1933 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1934 (match_operand:SI 2 "reg_or_short_operand" ""))
1935 (const_int 0)
1936 (minus:SI (match_dup 2) (match_dup 1))))
1937 (set (match_operand:SI 0 "gpc_reg_operand" "")
1938 (minus:SI (match_dup 2) (match_dup 3)))]
1939 "TARGET_POWER"
1940 "
1941 { operands[3] = gen_reg_rtx (SImode); }")
1942
1943 (define_split
1944 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1945 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1946 (match_operand:SI 2 "reg_or_short_operand" "")))
1947 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1948 "TARGET_POWER"
1949 [(set (match_dup 3)
1950 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1951 (const_int 0)
1952 (minus:SI (match_dup 2) (match_dup 1))))
1953 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1954 "")
1955
1956 (define_expand "smaxsi3"
1957 [(set (match_dup 3)
1958 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1959 (match_operand:SI 2 "reg_or_short_operand" ""))
1960 (const_int 0)
1961 (minus:SI (match_dup 2) (match_dup 1))))
1962 (set (match_operand:SI 0 "gpc_reg_operand" "")
1963 (plus:SI (match_dup 3) (match_dup 1)))]
1964 "TARGET_POWER"
1965 "
1966 { operands[3] = gen_reg_rtx (SImode); }")
1967
1968 (define_split
1969 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1970 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1971 (match_operand:SI 2 "reg_or_short_operand" "")))
1972 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1973 "TARGET_POWER"
1974 [(set (match_dup 3)
1975 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1976 (const_int 0)
1977 (minus:SI (match_dup 2) (match_dup 1))))
1978 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1979 "")
1980
1981 (define_expand "uminsi3"
1982 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1983 (match_dup 5)))
1984 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1985 (match_dup 5)))
1986 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1987 (const_int 0)
1988 (minus:SI (match_dup 4) (match_dup 3))))
1989 (set (match_operand:SI 0 "gpc_reg_operand" "")
1990 (minus:SI (match_dup 2) (match_dup 3)))]
1991 "TARGET_POWER"
1992 "
1993 {
1994 operands[3] = gen_reg_rtx (SImode);
1995 operands[4] = gen_reg_rtx (SImode);
1996 operands[5] = GEN_INT (-2147483647 - 1);
1997 }")
1998
1999 (define_expand "umaxsi3"
2000 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2001 (match_dup 5)))
2002 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
2003 (match_dup 5)))
2004 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
2005 (const_int 0)
2006 (minus:SI (match_dup 4) (match_dup 3))))
2007 (set (match_operand:SI 0 "gpc_reg_operand" "")
2008 (plus:SI (match_dup 3) (match_dup 1)))]
2009 "TARGET_POWER"
2010 "
2011 {
2012 operands[3] = gen_reg_rtx (SImode);
2013 operands[4] = gen_reg_rtx (SImode);
2014 operands[5] = GEN_INT (-2147483647 - 1);
2015 }")
2016
2017 (define_insn ""
2018 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2019 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
2020 (match_operand:SI 2 "reg_or_short_operand" "rI"))
2021 (const_int 0)
2022 (minus:SI (match_dup 2) (match_dup 1))))]
2023 "TARGET_POWER"
2024 "doz%I2 %0,%1,%2")
2025
2026 (define_insn ""
2027 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2028 (compare:CC
2029 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
2030 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
2031 (const_int 0)
2032 (minus:SI (match_dup 2) (match_dup 1)))
2033 (const_int 0)))
2034 (clobber (match_scratch:SI 3 "=r,r"))]
2035 "TARGET_POWER"
2036 "@
2037 doz%I2. %3,%1,%2
2038 #"
2039 [(set_attr "type" "delayed_compare")
2040 (set_attr "length" "4,8")])
2041
2042 (define_split
2043 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2044 (compare:CC
2045 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2046 (match_operand:SI 2 "reg_or_short_operand" ""))
2047 (const_int 0)
2048 (minus:SI (match_dup 2) (match_dup 1)))
2049 (const_int 0)))
2050 (clobber (match_scratch:SI 3 ""))]
2051 "TARGET_POWER && reload_completed"
2052 [(set (match_dup 3)
2053 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2054 (const_int 0)
2055 (minus:SI (match_dup 2) (match_dup 1))))
2056 (set (match_dup 0)
2057 (compare:CC (match_dup 3)
2058 (const_int 0)))]
2059 "")
2060
2061 (define_insn ""
2062 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2063 (compare:CC
2064 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
2065 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
2066 (const_int 0)
2067 (minus:SI (match_dup 2) (match_dup 1)))
2068 (const_int 0)))
2069 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2070 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2071 (const_int 0)
2072 (minus:SI (match_dup 2) (match_dup 1))))]
2073 "TARGET_POWER"
2074 "@
2075 doz%I2. %0,%1,%2
2076 #"
2077 [(set_attr "type" "delayed_compare")
2078 (set_attr "length" "4,8")])
2079
2080 (define_split
2081 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2082 (compare:CC
2083 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2084 (match_operand:SI 2 "reg_or_short_operand" ""))
2085 (const_int 0)
2086 (minus:SI (match_dup 2) (match_dup 1)))
2087 (const_int 0)))
2088 (set (match_operand:SI 0 "gpc_reg_operand" "")
2089 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2090 (const_int 0)
2091 (minus:SI (match_dup 2) (match_dup 1))))]
2092 "TARGET_POWER && reload_completed"
2093 [(set (match_dup 0)
2094 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2095 (const_int 0)
2096 (minus:SI (match_dup 2) (match_dup 1))))
2097 (set (match_dup 3)
2098 (compare:CC (match_dup 0)
2099 (const_int 0)))]
2100 "")
2101
2102 ;; We don't need abs with condition code because such comparisons should
2103 ;; never be done.
2104 (define_expand "abssi2"
2105 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2106 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2107 ""
2108 "
2109 {
2110 if (! TARGET_POWER)
2111 {
2112 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
2113 DONE;
2114 }
2115 }")
2116
2117 (define_insn "*abssi2_power"
2118 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2119 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2120 "TARGET_POWER"
2121 "abs %0,%1")
2122
2123 (define_insn_and_split "abssi2_nopower"
2124 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2125 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
2126 (clobber (match_scratch:SI 2 "=&r,&r"))]
2127 "! TARGET_POWER"
2128 "#"
2129 "&& reload_completed"
2130 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2131 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2132 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
2133 "")
2134
2135 (define_insn "*nabs_power"
2136 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2137 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
2138 "TARGET_POWER"
2139 "nabs %0,%1")
2140
2141 (define_insn_and_split "*nabs_nopower"
2142 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2143 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
2144 (clobber (match_scratch:SI 2 "=&r,&r"))]
2145 "! TARGET_POWER"
2146 "#"
2147 "&& reload_completed"
2148 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2149 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2150 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
2151 "")
2152
2153 (define_insn "negsi2"
2154 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2155 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2156 ""
2157 "neg %0,%1")
2158
2159 (define_insn ""
2160 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2161 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2162 (const_int 0)))
2163 (clobber (match_scratch:SI 2 "=r,r"))]
2164 "! TARGET_POWERPC64"
2165 "@
2166 neg. %2,%1
2167 #"
2168 [(set_attr "type" "compare")
2169 (set_attr "length" "4,8")])
2170
2171 (define_split
2172 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2173 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2174 (const_int 0)))
2175 (clobber (match_scratch:SI 2 ""))]
2176 "! TARGET_POWERPC64 && reload_completed"
2177 [(set (match_dup 2)
2178 (neg:SI (match_dup 1)))
2179 (set (match_dup 0)
2180 (compare:CC (match_dup 2)
2181 (const_int 0)))]
2182 "")
2183
2184 (define_insn ""
2185 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2186 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2187 (const_int 0)))
2188 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2189 (neg:SI (match_dup 1)))]
2190 "! TARGET_POWERPC64"
2191 "@
2192 neg. %0,%1
2193 #"
2194 [(set_attr "type" "compare")
2195 (set_attr "length" "4,8")])
2196
2197 (define_split
2198 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2199 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2200 (const_int 0)))
2201 (set (match_operand:SI 0 "gpc_reg_operand" "")
2202 (neg:SI (match_dup 1)))]
2203 "! TARGET_POWERPC64 && reload_completed"
2204 [(set (match_dup 0)
2205 (neg:SI (match_dup 1)))
2206 (set (match_dup 2)
2207 (compare:CC (match_dup 0)
2208 (const_int 0)))]
2209 "")
2210
2211 (define_insn "ffssi2"
2212 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
2213 (ffs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2214 ""
2215 "neg %0,%1\;and %0,%0,%1\;{cntlz|cntlzw} %0,%0\;{sfi|subfic} %0,%0,32"
2216 [(set_attr "length" "16")])
2217
2218 (define_expand "mulsi3"
2219 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2220 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2221 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
2222 ""
2223 "
2224 {
2225 if (TARGET_POWER)
2226 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
2227 else
2228 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
2229 DONE;
2230 }")
2231
2232 (define_insn "mulsi3_mq"
2233 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2234 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2235 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2236 (clobber (match_scratch:SI 3 "=q,q"))]
2237 "TARGET_POWER"
2238 "@
2239 {muls|mullw} %0,%1,%2
2240 {muli|mulli} %0,%1,%2"
2241 [(set (attr "type")
2242 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2243 (const_string "imul3")
2244 (match_operand:SI 2 "short_cint_operand" "")
2245 (const_string "imul2")]
2246 (const_string "imul")))])
2247
2248 (define_insn "mulsi3_no_mq"
2249 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2250 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2251 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2252 "! TARGET_POWER"
2253 "@
2254 {muls|mullw} %0,%1,%2
2255 {muli|mulli} %0,%1,%2"
2256 [(set (attr "type")
2257 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2258 (const_string "imul3")
2259 (match_operand:SI 2 "short_cint_operand" "")
2260 (const_string "imul2")]
2261 (const_string "imul")))])
2262
2263 (define_insn ""
2264 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2265 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2266 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2267 (const_int 0)))
2268 (clobber (match_scratch:SI 3 "=r,r"))
2269 (clobber (match_scratch:SI 4 "=q,q"))]
2270 "TARGET_POWER"
2271 "@
2272 {muls.|mullw.} %3,%1,%2
2273 #"
2274 [(set_attr "type" "delayed_compare")
2275 (set_attr "length" "4,8")])
2276
2277 (define_split
2278 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2279 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2280 (match_operand:SI 2 "gpc_reg_operand" ""))
2281 (const_int 0)))
2282 (clobber (match_scratch:SI 3 ""))
2283 (clobber (match_scratch:SI 4 ""))]
2284 "TARGET_POWER && reload_completed"
2285 [(parallel [(set (match_dup 3)
2286 (mult:SI (match_dup 1) (match_dup 2)))
2287 (clobber (match_dup 4))])
2288 (set (match_dup 0)
2289 (compare:CC (match_dup 3)
2290 (const_int 0)))]
2291 "")
2292
2293 (define_insn ""
2294 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2295 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2296 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2297 (const_int 0)))
2298 (clobber (match_scratch:SI 3 "=r,r"))]
2299 "! TARGET_POWER"
2300 "@
2301 {muls.|mullw.} %3,%1,%2
2302 #"
2303 [(set_attr "type" "delayed_compare")
2304 (set_attr "length" "4,8")])
2305
2306 (define_split
2307 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2308 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2309 (match_operand:SI 2 "gpc_reg_operand" ""))
2310 (const_int 0)))
2311 (clobber (match_scratch:SI 3 ""))]
2312 "! TARGET_POWER && reload_completed"
2313 [(set (match_dup 3)
2314 (mult:SI (match_dup 1) (match_dup 2)))
2315 (set (match_dup 0)
2316 (compare:CC (match_dup 3)
2317 (const_int 0)))]
2318 "")
2319
2320 (define_insn ""
2321 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2322 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2323 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2324 (const_int 0)))
2325 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2326 (mult:SI (match_dup 1) (match_dup 2)))
2327 (clobber (match_scratch:SI 4 "=q,q"))]
2328 "TARGET_POWER"
2329 "@
2330 {muls.|mullw.} %0,%1,%2
2331 #"
2332 [(set_attr "type" "delayed_compare")
2333 (set_attr "length" "4,8")])
2334
2335 (define_split
2336 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2337 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2338 (match_operand:SI 2 "gpc_reg_operand" ""))
2339 (const_int 0)))
2340 (set (match_operand:SI 0 "gpc_reg_operand" "")
2341 (mult:SI (match_dup 1) (match_dup 2)))
2342 (clobber (match_scratch:SI 4 ""))]
2343 "TARGET_POWER && reload_completed"
2344 [(parallel [(set (match_dup 0)
2345 (mult:SI (match_dup 1) (match_dup 2)))
2346 (clobber (match_dup 4))])
2347 (set (match_dup 3)
2348 (compare:CC (match_dup 0)
2349 (const_int 0)))]
2350 "")
2351
2352 (define_insn ""
2353 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2354 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2355 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2356 (const_int 0)))
2357 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2358 (mult:SI (match_dup 1) (match_dup 2)))]
2359 "! TARGET_POWER"
2360 "@
2361 {muls.|mullw.} %0,%1,%2
2362 #"
2363 [(set_attr "type" "delayed_compare")
2364 (set_attr "length" "4,8")])
2365
2366 (define_split
2367 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2368 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2369 (match_operand:SI 2 "gpc_reg_operand" ""))
2370 (const_int 0)))
2371 (set (match_operand:SI 0 "gpc_reg_operand" "")
2372 (mult:SI (match_dup 1) (match_dup 2)))]
2373 "! TARGET_POWER && reload_completed"
2374 [(set (match_dup 0)
2375 (mult:SI (match_dup 1) (match_dup 2)))
2376 (set (match_dup 3)
2377 (compare:CC (match_dup 0)
2378 (const_int 0)))]
2379 "")
2380
2381 ;; Operand 1 is divided by operand 2; quotient goes to operand
2382 ;; 0 and remainder to operand 3.
2383 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
2384
2385 (define_expand "divmodsi4"
2386 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2387 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2388 (match_operand:SI 2 "gpc_reg_operand" "")))
2389 (set (match_operand:SI 3 "gpc_reg_operand" "")
2390 (mod:SI (match_dup 1) (match_dup 2)))])]
2391 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
2392 "
2393 {
2394 if (! TARGET_POWER && ! TARGET_POWERPC)
2395 {
2396 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2397 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2398 emit_insn (gen_divss_call ());
2399 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2400 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2401 DONE;
2402 }
2403 }")
2404
2405 (define_insn ""
2406 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2407 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2408 (match_operand:SI 2 "gpc_reg_operand" "r")))
2409 (set (match_operand:SI 3 "gpc_reg_operand" "=q")
2410 (mod:SI (match_dup 1) (match_dup 2)))]
2411 "TARGET_POWER"
2412 "divs %0,%1,%2"
2413 [(set_attr "type" "idiv")])
2414
2415 (define_expand "udivsi3"
2416 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2417 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2418 (match_operand:SI 2 "gpc_reg_operand" "")))]
2419 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
2420 "
2421 {
2422 if (! TARGET_POWER && ! TARGET_POWERPC)
2423 {
2424 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2425 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2426 emit_insn (gen_quous_call ());
2427 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2428 DONE;
2429 }
2430 else if (TARGET_POWER)
2431 {
2432 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
2433 DONE;
2434 }
2435 }")
2436
2437 (define_insn "udivsi3_mq"
2438 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2439 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2440 (match_operand:SI 2 "gpc_reg_operand" "r")))
2441 (clobber (match_scratch:SI 3 "=q"))]
2442 "TARGET_POWERPC && TARGET_POWER"
2443 "divwu %0,%1,%2"
2444 [(set_attr "type" "idiv")])
2445
2446 (define_insn "*udivsi3_no_mq"
2447 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2448 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2449 (match_operand:SI 2 "gpc_reg_operand" "r")))]
2450 "TARGET_POWERPC && ! TARGET_POWER"
2451 "divwu %0,%1,%2"
2452 [(set_attr "type" "idiv")])
2453
2454 ;; For powers of two we can do srai/aze for divide and then adjust for
2455 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
2456 ;; used; for PowerPC, force operands into register and do a normal divide;
2457 ;; for AIX common-mode, use quoss call on register operands.
2458 (define_expand "divsi3"
2459 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2460 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2461 (match_operand:SI 2 "reg_or_cint_operand" "")))]
2462 ""
2463 "
2464 {
2465 if (GET_CODE (operands[2]) == CONST_INT
2466 && INTVAL (operands[2]) > 0
2467 && exact_log2 (INTVAL (operands[2])) >= 0)
2468 ;
2469 else if (TARGET_POWERPC)
2470 {
2471 operands[2] = force_reg (SImode, operands[2]);
2472 if (TARGET_POWER)
2473 {
2474 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
2475 DONE;
2476 }
2477 }
2478 else if (TARGET_POWER)
2479 FAIL;
2480 else
2481 {
2482 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2483 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2484 emit_insn (gen_quoss_call ());
2485 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2486 DONE;
2487 }
2488 }")
2489
2490 (define_insn "divsi3_mq"
2491 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2492 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2493 (match_operand:SI 2 "gpc_reg_operand" "r")))
2494 (clobber (match_scratch:SI 3 "=q"))]
2495 "TARGET_POWERPC && TARGET_POWER"
2496 "divw %0,%1,%2"
2497 [(set_attr "type" "idiv")])
2498
2499 (define_insn "*divsi3_no_mq"
2500 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2501 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2502 (match_operand:SI 2 "gpc_reg_operand" "r")))]
2503 "TARGET_POWERPC && ! TARGET_POWER"
2504 "divw %0,%1,%2"
2505 [(set_attr "type" "idiv")])
2506
2507 (define_expand "modsi3"
2508 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2509 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2510 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
2511 ""
2512 "
2513 {
2514 int i;
2515 rtx temp1;
2516 rtx temp2;
2517
2518 if (GET_CODE (operands[2]) != CONST_INT
2519 || INTVAL (operands[2]) <= 0
2520 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2521 FAIL;
2522
2523 temp1 = gen_reg_rtx (SImode);
2524 temp2 = gen_reg_rtx (SImode);
2525
2526 emit_insn (gen_divsi3 (temp1, operands[1], operands[2]));
2527 emit_insn (gen_ashlsi3 (temp2, temp1, GEN_INT (i)));
2528 emit_insn (gen_subsi3 (operands[0], operands[1], temp2));
2529 DONE;
2530 }")
2531
2532 (define_insn ""
2533 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2534 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2535 (match_operand:SI 2 "exact_log2_cint_operand" "N")))]
2536 ""
2537 "{srai|srawi} %0,%1,%p2\;{aze|addze} %0,%0"
2538 [(set_attr "length" "8")])
2539
2540 (define_insn ""
2541 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2542 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2543 (match_operand:SI 2 "exact_log2_cint_operand" "N,N"))
2544 (const_int 0)))
2545 (clobber (match_scratch:SI 3 "=r,r"))]
2546 ""
2547 "@
2548 {srai|srawi} %3,%1,%p2\;{aze.|addze.} %3,%3
2549 #"
2550 [(set_attr "type" "compare")
2551 (set_attr "length" "8,12")])
2552
2553 (define_split
2554 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2555 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2556 (match_operand:SI 2 "exact_log2_cint_operand" ""))
2557 (const_int 0)))
2558 (clobber (match_scratch:SI 3 ""))]
2559 "reload_completed"
2560 [(set (match_dup 3)
2561 (div:SI (match_dup 1) (match_dup 2)))
2562 (set (match_dup 0)
2563 (compare:CC (match_dup 3)
2564 (const_int 0)))]
2565 "")
2566
2567 (define_insn ""
2568 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2569 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2570 (match_operand:SI 2 "exact_log2_cint_operand" "N,N"))
2571 (const_int 0)))
2572 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2573 (div:SI (match_dup 1) (match_dup 2)))]
2574 ""
2575 "@
2576 {srai|srawi} %0,%1,%p2\;{aze.|addze.} %0,%0
2577 #"
2578 [(set_attr "type" "compare")
2579 (set_attr "length" "8,12")])
2580
2581 (define_split
2582 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2583 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2584 (match_operand:SI 2 "exact_log2_cint_operand" ""))
2585 (const_int 0)))
2586 (set (match_operand:SI 0 "gpc_reg_operand" "")
2587 (div:SI (match_dup 1) (match_dup 2)))]
2588 "reload_completed"
2589 [(set (match_dup 0)
2590 (div:SI (match_dup 1) (match_dup 2)))
2591 (set (match_dup 3)
2592 (compare:CC (match_dup 0)
2593 (const_int 0)))]
2594 "")
2595
2596 (define_insn ""
2597 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2598 (udiv:SI
2599 (plus:DI (ashift:DI
2600 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2601 (const_int 32))
2602 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2603 (match_operand:SI 3 "gpc_reg_operand" "r")))
2604 (set (match_operand:SI 2 "register_operand" "=*q")
2605 (umod:SI
2606 (plus:DI (ashift:DI
2607 (zero_extend:DI (match_dup 1)) (const_int 32))
2608 (zero_extend:DI (match_dup 4)))
2609 (match_dup 3)))]
2610 "TARGET_POWER"
2611 "div %0,%1,%3"
2612 [(set_attr "type" "idiv")])
2613
2614 ;; To do unsigned divide we handle the cases of the divisor looking like a
2615 ;; negative number. If it is a constant that is less than 2**31, we don't
2616 ;; have to worry about the branches. So make a few subroutines here.
2617 ;;
2618 ;; First comes the normal case.
2619 (define_expand "udivmodsi4_normal"
2620 [(set (match_dup 4) (const_int 0))
2621 (parallel [(set (match_operand:SI 0 "" "")
2622 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2623 (const_int 32))
2624 (zero_extend:DI (match_operand:SI 1 "" "")))
2625 (match_operand:SI 2 "" "")))
2626 (set (match_operand:SI 3 "" "")
2627 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2628 (const_int 32))
2629 (zero_extend:DI (match_dup 1)))
2630 (match_dup 2)))])]
2631 "TARGET_POWER"
2632 "
2633 { operands[4] = gen_reg_rtx (SImode); }")
2634
2635 ;; This handles the branches.
2636 (define_expand "udivmodsi4_tests"
2637 [(set (match_operand:SI 0 "" "") (const_int 0))
2638 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2639 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2640 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2641 (label_ref (match_operand:SI 4 "" "")) (pc)))
2642 (set (match_dup 0) (const_int 1))
2643 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2644 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2645 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2646 (label_ref (match_dup 4)) (pc)))]
2647 "TARGET_POWER"
2648 "
2649 { operands[5] = gen_reg_rtx (CCUNSmode);
2650 operands[6] = gen_reg_rtx (CCmode);
2651 }")
2652
2653 (define_expand "udivmodsi4"
2654 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2655 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2656 (match_operand:SI 2 "reg_or_cint_operand" "")))
2657 (set (match_operand:SI 3 "gpc_reg_operand" "")
2658 (umod:SI (match_dup 1) (match_dup 2)))])]
2659 ""
2660 "
2661 {
2662 rtx label = 0;
2663
2664 if (! TARGET_POWER)
2665 {
2666 if (! TARGET_POWERPC)
2667 {
2668 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2669 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2670 emit_insn (gen_divus_call ());
2671 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2672 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2673 DONE;
2674 }
2675 else
2676 FAIL;
2677 }
2678
2679 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2680 {
2681 operands[2] = force_reg (SImode, operands[2]);
2682 label = gen_label_rtx ();
2683 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2684 operands[3], label));
2685 }
2686 else
2687 operands[2] = force_reg (SImode, operands[2]);
2688
2689 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2690 operands[3]));
2691 if (label)
2692 emit_label (label);
2693
2694 DONE;
2695 }")
2696
2697 ;; AIX architecture-independent common-mode multiply (DImode),
2698 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2699 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2700 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2701 ;; assumed unused if generating common-mode, so ignore.
2702 (define_insn "mulh_call"
2703 [(set (reg:SI 3)
2704 (truncate:SI
2705 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2706 (sign_extend:DI (reg:SI 4)))
2707 (const_int 32))))
2708 (clobber (match_scratch:SI 0 "=l"))]
2709 "! TARGET_POWER && ! TARGET_POWERPC"
2710 "bla __mulh"
2711 [(set_attr "type" "imul")])
2712
2713 (define_insn "mull_call"
2714 [(set (reg:DI 3)
2715 (mult:DI (sign_extend:DI (reg:SI 3))
2716 (sign_extend:DI (reg:SI 4))))
2717 (clobber (match_scratch:SI 0 "=l"))
2718 (clobber (reg:SI 0))]
2719 "! TARGET_POWER && ! TARGET_POWERPC"
2720 "bla __mull"
2721 [(set_attr "type" "imul")])
2722
2723 (define_insn "divss_call"
2724 [(set (reg:SI 3)
2725 (div:SI (reg:SI 3) (reg:SI 4)))
2726 (set (reg:SI 4)
2727 (mod:SI (reg:SI 3) (reg:SI 4)))
2728 (clobber (match_scratch:SI 0 "=l"))
2729 (clobber (reg:SI 0))]
2730 "! TARGET_POWER && ! TARGET_POWERPC"
2731 "bla __divss"
2732 [(set_attr "type" "idiv")])
2733
2734 (define_insn "divus_call"
2735 [(set (reg:SI 3)
2736 (udiv:SI (reg:SI 3) (reg:SI 4)))
2737 (set (reg:SI 4)
2738 (umod:SI (reg:SI 3) (reg:SI 4)))
2739 (clobber (match_scratch:SI 0 "=l"))
2740 (clobber (reg:SI 0))
2741 (clobber (match_scratch:CC 1 "=x"))
2742 (clobber (reg:CC 69))]
2743 "! TARGET_POWER && ! TARGET_POWERPC"
2744 "bla __divus"
2745 [(set_attr "type" "idiv")])
2746
2747 (define_insn "quoss_call"
2748 [(set (reg:SI 3)
2749 (div:SI (reg:SI 3) (reg:SI 4)))
2750 (clobber (match_scratch:SI 0 "=l"))]
2751 "! TARGET_POWER && ! TARGET_POWERPC"
2752 "bla __quoss"
2753 [(set_attr "type" "idiv")])
2754
2755 (define_insn "quous_call"
2756 [(set (reg:SI 3)
2757 (udiv:SI (reg:SI 3) (reg:SI 4)))
2758 (clobber (match_scratch:SI 0 "=l"))
2759 (clobber (reg:SI 0))
2760 (clobber (match_scratch:CC 1 "=x"))
2761 (clobber (reg:CC 69))]
2762 "! TARGET_POWER && ! TARGET_POWERPC"
2763 "bla __quous"
2764 [(set_attr "type" "idiv")])
2765 \f
2766 ;; Logical instructions
2767 ;; The logical instructions are mostly combined by using match_operator,
2768 ;; but the plain AND insns are somewhat different because there is no
2769 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2770 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2771
2772 (define_insn "andsi3"
2773 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2774 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2775 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2776 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2777 ""
2778 "@
2779 and %0,%1,%2
2780 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2781 {andil.|andi.} %0,%1,%b2
2782 {andiu.|andis.} %0,%1,%u2")
2783
2784 ;; Note to set cr's other than cr0 we do the and immediate and then
2785 ;; the test again -- this avoids a mcrf which on the higher end
2786 ;; machines causes an execution serialization
2787
2788 (define_insn "*andsi3_internal2"
2789 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2790 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2791 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2792 (const_int 0)))
2793 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2794 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2795 "! TARGET_POWERPC64"
2796 "@
2797 and. %3,%1,%2
2798 {andil.|andi.} %3,%1,%b2
2799 {andiu.|andis.} %3,%1,%u2
2800 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2801 #
2802 #
2803 #
2804 #"
2805 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2806 (set_attr "length" "4,4,4,4,8,8,8,8")])
2807
2808 (define_split
2809 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2810 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2811 (match_operand:SI 2 "and_operand" ""))
2812 (const_int 0)))
2813 (clobber (match_scratch:SI 3 ""))
2814 (clobber (match_scratch:CC 4 ""))]
2815 "! TARGET_POWERPC64 && reload_completed"
2816 [(parallel [(set (match_dup 3)
2817 (and:SI (match_dup 1)
2818 (match_dup 2)))
2819 (clobber (match_dup 4))])
2820 (set (match_dup 0)
2821 (compare:CC (match_dup 3)
2822 (const_int 0)))]
2823 "")
2824
2825 (define_insn "*andsi3_internal3"
2826 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2827 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2828 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2829 (const_int 0)))
2830 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2831 (and:SI (match_dup 1)
2832 (match_dup 2)))
2833 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2834 "! TARGET_POWERPC64"
2835 "@
2836 and. %0,%1,%2
2837 {andil.|andi.} %0,%1,%b2
2838 {andiu.|andis.} %0,%1,%u2
2839 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2840 #
2841 #
2842 #
2843 #"
2844 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2845 (set_attr "length" "4,4,4,4,8,8,8,8")])
2846
2847 (define_split
2848 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2849 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2850 (match_operand:SI 2 "and_operand" ""))
2851 (const_int 0)))
2852 (set (match_operand:SI 0 "gpc_reg_operand" "")
2853 (and:SI (match_dup 1)
2854 (match_dup 2)))
2855 (clobber (match_scratch:CC 4 ""))]
2856 "! TARGET_POWERPC64 && reload_completed"
2857 [(parallel [(set (match_dup 0)
2858 (and:SI (match_dup 1)
2859 (match_dup 2)))
2860 (clobber (match_dup 4))])
2861 (set (match_dup 3)
2862 (compare:CC (match_dup 0)
2863 (const_int 0)))]
2864 "")
2865
2866 (define_expand "iorsi3"
2867 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2868 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2869 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2870 ""
2871 "
2872 {
2873 if (GET_CODE (operands[2]) == CONST_INT
2874 && ! logical_operand (operands[2], SImode))
2875 {
2876 HOST_WIDE_INT value = INTVAL (operands[2]);
2877 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2878 ? operands[0] : gen_reg_rtx (SImode));
2879
2880 emit_insn (gen_iorsi3 (tmp, operands[1],
2881 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2882 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2883 DONE;
2884 }
2885 }")
2886
2887 (define_expand "xorsi3"
2888 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2889 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2890 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2891 ""
2892 "
2893 {
2894 if (GET_CODE (operands[2]) == CONST_INT
2895 && ! logical_operand (operands[2], SImode))
2896 {
2897 HOST_WIDE_INT value = INTVAL (operands[2]);
2898 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2899 ? operands[0] : gen_reg_rtx (SImode));
2900
2901 emit_insn (gen_xorsi3 (tmp, operands[1],
2902 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2903 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2904 DONE;
2905 }
2906 }")
2907
2908 (define_insn "*boolsi3_internal1"
2909 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2910 (match_operator:SI 3 "boolean_or_operator"
2911 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
2912 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
2913 ""
2914 "@
2915 %q3 %0,%1,%2
2916 {%q3il|%q3i} %0,%1,%b2
2917 {%q3iu|%q3is} %0,%1,%u2")
2918
2919 (define_insn "*boolsi3_internal2"
2920 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2921 (compare:CC (match_operator:SI 4 "boolean_or_operator"
2922 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2923 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2924 (const_int 0)))
2925 (clobber (match_scratch:SI 3 "=r,r"))]
2926 "! TARGET_POWERPC64"
2927 "@
2928 %q4. %3,%1,%2
2929 #"
2930 [(set_attr "type" "compare")
2931 (set_attr "length" "4,8")])
2932
2933 (define_split
2934 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2935 (compare:CC (match_operator:SI 4 "boolean_operator"
2936 [(match_operand:SI 1 "gpc_reg_operand" "")
2937 (match_operand:SI 2 "gpc_reg_operand" "")])
2938 (const_int 0)))
2939 (clobber (match_scratch:SI 3 ""))]
2940 "! TARGET_POWERPC64 && reload_completed"
2941 [(set (match_dup 3) (match_dup 4))
2942 (set (match_dup 0)
2943 (compare:CC (match_dup 3)
2944 (const_int 0)))]
2945 "")
2946
2947 (define_insn "*boolsi3_internal3"
2948 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2949 (compare:CC (match_operator:SI 4 "boolean_operator"
2950 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2951 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2952 (const_int 0)))
2953 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2954 (match_dup 4))]
2955 "! TARGET_POWERPC64"
2956 "@
2957 %q4. %0,%1,%2
2958 #"
2959 [(set_attr "type" "compare")
2960 (set_attr "length" "4,8")])
2961
2962 (define_split
2963 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2964 (compare:CC (match_operator:SI 4 "boolean_operator"
2965 [(match_operand:SI 1 "gpc_reg_operand" "")
2966 (match_operand:SI 2 "gpc_reg_operand" "")])
2967 (const_int 0)))
2968 (set (match_operand:SI 0 "gpc_reg_operand" "")
2969 (match_dup 4))]
2970 "! TARGET_POWERPC64 && reload_completed"
2971 [(set (match_dup 0) (match_dup 4))
2972 (set (match_dup 3)
2973 (compare:CC (match_dup 0)
2974 (const_int 0)))]
2975 "")
2976
2977 ;; Split an logical operation that we can't do in one insn into two insns,
2978 ;; each of which does one 16-bit part. This is used by combine.
2979
2980 (define_split
2981 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2982 (match_operator:SI 3 "boolean_or_operator"
2983 [(match_operand:SI 1 "gpc_reg_operand" "")
2984 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
2985 ""
2986 [(set (match_dup 0) (match_dup 4))
2987 (set (match_dup 0) (match_dup 5))]
2988 "
2989 {
2990 rtx i;
2991 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
2992 operands[4] = gen_rtx (GET_CODE (operands[3]), SImode,
2993 operands[1], i);
2994 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
2995 operands[5] = gen_rtx (GET_CODE (operands[3]), SImode,
2996 operands[0], i);
2997 }")
2998
2999 (define_insn "*boolcsi3_internal1"
3000 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3001 (match_operator:SI 3 "boolean_operator"
3002 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3003 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3004 ""
3005 "%q3 %0,%2,%1")
3006
3007 (define_insn "*boolcsi3_internal2"
3008 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3009 (compare:CC (match_operator:SI 4 "boolean_operator"
3010 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3011 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3012 (const_int 0)))
3013 (clobber (match_scratch:SI 3 "=r,r"))]
3014 "! TARGET_POWERPC64"
3015 "@
3016 %q4. %3,%2,%1
3017 #"
3018 [(set_attr "type" "compare")
3019 (set_attr "length" "4,8")])
3020
3021 (define_split
3022 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3023 (compare:CC (match_operator:SI 4 "boolean_operator"
3024 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3025 (match_operand:SI 2 "gpc_reg_operand" "")])
3026 (const_int 0)))
3027 (clobber (match_scratch:SI 3 ""))]
3028 "! TARGET_POWERPC64 && reload_completed"
3029 [(set (match_dup 3) (match_dup 4))
3030 (set (match_dup 0)
3031 (compare:CC (match_dup 3)
3032 (const_int 0)))]
3033 "")
3034
3035 (define_insn "*boolcsi3_internal3"
3036 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3037 (compare:CC (match_operator:SI 4 "boolean_operator"
3038 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3039 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3040 (const_int 0)))
3041 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3042 (match_dup 4))]
3043 "! TARGET_POWERPC64"
3044 "@
3045 %q4. %0,%2,%1
3046 #"
3047 [(set_attr "type" "compare")
3048 (set_attr "length" "4,8")])
3049
3050 (define_split
3051 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3052 (compare:CC (match_operator:SI 4 "boolean_operator"
3053 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3054 (match_operand:SI 2 "gpc_reg_operand" "")])
3055 (const_int 0)))
3056 (set (match_operand:SI 0 "gpc_reg_operand" "")
3057 (match_dup 4))]
3058 "! TARGET_POWERPC64 && reload_completed"
3059 [(set (match_dup 0) (match_dup 4))
3060 (set (match_dup 3)
3061 (compare:CC (match_dup 0)
3062 (const_int 0)))]
3063 "")
3064
3065 (define_insn "*boolccsi3_internal1"
3066 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3067 (match_operator:SI 3 "boolean_operator"
3068 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3069 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3070 ""
3071 "%q3 %0,%1,%2")
3072
3073 (define_insn "*boolccsi3_internal2"
3074 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3075 (compare:CC (match_operator:SI 4 "boolean_operator"
3076 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3077 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3078 (const_int 0)))
3079 (clobber (match_scratch:SI 3 "=r,r"))]
3080 "! TARGET_POWERPC64"
3081 "@
3082 %q4. %3,%1,%2
3083 #"
3084 [(set_attr "type" "compare")
3085 (set_attr "length" "4,8")])
3086
3087 (define_split
3088 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3089 (compare:CC (match_operator:SI 4 "boolean_operator"
3090 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3091 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3092 (const_int 0)))
3093 (clobber (match_scratch:SI 3 ""))]
3094 "! TARGET_POWERPC64 && reload_completed"
3095 [(set (match_dup 3) (match_dup 4))
3096 (set (match_dup 0)
3097 (compare:CC (match_dup 3)
3098 (const_int 0)))]
3099 "")
3100
3101 (define_insn "*boolccsi3_internal3"
3102 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3103 (compare:CC (match_operator:SI 4 "boolean_operator"
3104 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3105 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3106 (const_int 0)))
3107 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3108 (match_dup 4))]
3109 "! TARGET_POWERPC64"
3110 "@
3111 %q4. %0,%1,%2
3112 #"
3113 [(set_attr "type" "compare")
3114 (set_attr "length" "4,8")])
3115
3116 (define_split
3117 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3118 (compare:CC (match_operator:SI 4 "boolean_operator"
3119 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3120 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3121 (const_int 0)))
3122 (set (match_operand:SI 0 "gpc_reg_operand" "")
3123 (match_dup 4))]
3124 "! TARGET_POWERPC64 && reload_completed"
3125 [(set (match_dup 0) (match_dup 4))
3126 (set (match_dup 3)
3127 (compare:CC (match_dup 0)
3128 (const_int 0)))]
3129 "")
3130
3131 ;; maskir insn. We need four forms because things might be in arbitrary
3132 ;; orders. Don't define forms that only set CR fields because these
3133 ;; would modify an input register.
3134
3135 (define_insn "*maskir_internal1"
3136 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3137 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3138 (match_operand:SI 1 "gpc_reg_operand" "0"))
3139 (and:SI (match_dup 2)
3140 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
3141 "TARGET_POWER"
3142 "maskir %0,%3,%2")
3143
3144 (define_insn "*maskir_internal2"
3145 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3146 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3147 (match_operand:SI 1 "gpc_reg_operand" "0"))
3148 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3149 (match_dup 2))))]
3150 "TARGET_POWER"
3151 "maskir %0,%3,%2")
3152
3153 (define_insn "*maskir_internal3"
3154 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3155 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3156 (match_operand:SI 3 "gpc_reg_operand" "r"))
3157 (and:SI (not:SI (match_dup 2))
3158 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3159 "TARGET_POWER"
3160 "maskir %0,%3,%2")
3161
3162 (define_insn "*maskir_internal4"
3163 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3164 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3165 (match_operand:SI 2 "gpc_reg_operand" "r"))
3166 (and:SI (not:SI (match_dup 2))
3167 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3168 "TARGET_POWER"
3169 "maskir %0,%3,%2")
3170
3171 (define_insn "*maskir_internal5"
3172 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3173 (compare:CC
3174 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3175 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3176 (and:SI (match_dup 2)
3177 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3178 (const_int 0)))
3179 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3180 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3181 (and:SI (match_dup 2) (match_dup 3))))]
3182 "TARGET_POWER"
3183 "@
3184 maskir. %0,%3,%2
3185 #"
3186 [(set_attr "type" "compare")
3187 (set_attr "length" "4,8")])
3188
3189 (define_split
3190 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3191 (compare:CC
3192 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3193 (match_operand:SI 1 "gpc_reg_operand" ""))
3194 (and:SI (match_dup 2)
3195 (match_operand:SI 3 "gpc_reg_operand" "")))
3196 (const_int 0)))
3197 (set (match_operand:SI 0 "gpc_reg_operand" "")
3198 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3199 (and:SI (match_dup 2) (match_dup 3))))]
3200 "TARGET_POWER && reload_completed"
3201 [(set (match_dup 0)
3202 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3203 (and:SI (match_dup 2) (match_dup 3))))
3204 (set (match_dup 4)
3205 (compare:CC (match_dup 0)
3206 (const_int 0)))]
3207 "")
3208
3209 (define_insn "*maskir_internal6"
3210 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3211 (compare:CC
3212 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3213 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3214 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3215 (match_dup 2)))
3216 (const_int 0)))
3217 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3218 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3219 (and:SI (match_dup 3) (match_dup 2))))]
3220 "TARGET_POWER"
3221 "@
3222 maskir. %0,%3,%2
3223 #"
3224 [(set_attr "type" "compare")
3225 (set_attr "length" "4,8")])
3226
3227 (define_split
3228 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3229 (compare:CC
3230 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3231 (match_operand:SI 1 "gpc_reg_operand" ""))
3232 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3233 (match_dup 2)))
3234 (const_int 0)))
3235 (set (match_operand:SI 0 "gpc_reg_operand" "")
3236 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3237 (and:SI (match_dup 3) (match_dup 2))))]
3238 "TARGET_POWER && reload_completed"
3239 [(set (match_dup 0)
3240 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3241 (and:SI (match_dup 3) (match_dup 2))))
3242 (set (match_dup 4)
3243 (compare:CC (match_dup 0)
3244 (const_int 0)))]
3245 "")
3246
3247 (define_insn "*maskir_internal7"
3248 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3249 (compare:CC
3250 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
3251 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3252 (and:SI (not:SI (match_dup 2))
3253 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3254 (const_int 0)))
3255 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3256 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3257 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3258 "TARGET_POWER"
3259 "@
3260 maskir. %0,%3,%2
3261 #"
3262 [(set_attr "type" "compare")
3263 (set_attr "length" "4,8")])
3264
3265 (define_split
3266 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3267 (compare:CC
3268 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
3269 (match_operand:SI 3 "gpc_reg_operand" ""))
3270 (and:SI (not:SI (match_dup 2))
3271 (match_operand:SI 1 "gpc_reg_operand" "")))
3272 (const_int 0)))
3273 (set (match_operand:SI 0 "gpc_reg_operand" "")
3274 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3275 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3276 "TARGET_POWER && reload_completed"
3277 [(set (match_dup 0)
3278 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3279 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3280 (set (match_dup 4)
3281 (compare:CC (match_dup 0)
3282 (const_int 0)))]
3283 "")
3284
3285 (define_insn "*maskir_internal8"
3286 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3287 (compare:CC
3288 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3289 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3290 (and:SI (not:SI (match_dup 2))
3291 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3292 (const_int 0)))
3293 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3294 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3295 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3296 "TARGET_POWER"
3297 "@
3298 maskir. %0,%3,%2
3299 #"
3300 [(set_attr "type" "compare")
3301 (set_attr "length" "4,8")])
3302 \f
3303 (define_split
3304 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3305 (compare:CC
3306 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3307 (match_operand:SI 2 "gpc_reg_operand" ""))
3308 (and:SI (not:SI (match_dup 2))
3309 (match_operand:SI 1 "gpc_reg_operand" "")))
3310 (const_int 0)))
3311 (set (match_operand:SI 0 "gpc_reg_operand" "")
3312 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3313 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3314 "TARGET_POWER && reload_completed"
3315 [(set (match_dup 0)
3316 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3317 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3318 (set (match_dup 4)
3319 (compare:CC (match_dup 0)
3320 (const_int 0)))]
3321 "")
3322
3323 ;; Rotate and shift insns, in all their variants. These support shifts,
3324 ;; field inserts and extracts, and various combinations thereof.
3325 (define_expand "insv"
3326 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3327 (match_operand:SI 1 "const_int_operand" "")
3328 (match_operand:SI 2 "const_int_operand" ""))
3329 (match_operand 3 "gpc_reg_operand" ""))]
3330 ""
3331 "
3332 {
3333 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3334 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3335 compiler if the address of the structure is taken later. */
3336 if (GET_CODE (operands[0]) == SUBREG
3337 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3338 FAIL;
3339
3340 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3341 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
3342 else
3343 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
3344 DONE;
3345 }")
3346
3347 (define_insn "insvsi"
3348 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3349 (match_operand:SI 1 "const_int_operand" "i")
3350 (match_operand:SI 2 "const_int_operand" "i"))
3351 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3352 ""
3353 "*
3354 {
3355 int start = INTVAL (operands[2]) & 31;
3356 int size = INTVAL (operands[1]) & 31;
3357
3358 operands[4] = GEN_INT (32 - start - size);
3359 operands[1] = GEN_INT (start + size - 1);
3360 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3361 }")
3362
3363 (define_insn "*insvsi_internal1"
3364 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3365 (match_operand:SI 1 "const_int_operand" "i")
3366 (match_operand:SI 2 "const_int_operand" "i"))
3367 (ashift:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3368 (match_operand:SI 4 "const_int_operand" "i")))]
3369 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3370 "*
3371 {
3372 int shift = INTVAL (operands[4]) & 31;
3373 int start = INTVAL (operands[2]) & 31;
3374 int size = INTVAL (operands[1]) & 31;
3375
3376 operands[4] = GEN_INT (shift - start - size);
3377 operands[1] = GEN_INT (start + size - 1);
3378 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3379 }")
3380
3381 (define_insn "*insvsi_internal2"
3382 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3383 (match_operand:SI 1 "const_int_operand" "i")
3384 (match_operand:SI 2 "const_int_operand" "i"))
3385 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3386 (match_operand:SI 4 "const_int_operand" "i")))]
3387 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3388 "*
3389 {
3390 int shift = INTVAL (operands[4]) & 31;
3391 int start = INTVAL (operands[2]) & 31;
3392 int size = INTVAL (operands[1]) & 31;
3393
3394 operands[4] = GEN_INT (32 - shift - start - size);
3395 operands[1] = GEN_INT (start + size - 1);
3396 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3397 }")
3398
3399 (define_insn "*insvsi_internal3"
3400 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3401 (match_operand:SI 1 "const_int_operand" "i")
3402 (match_operand:SI 2 "const_int_operand" "i"))
3403 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3404 (match_operand:SI 4 "const_int_operand" "i")))]
3405 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3406 "*
3407 {
3408 int shift = INTVAL (operands[4]) & 31;
3409 int start = INTVAL (operands[2]) & 31;
3410 int size = INTVAL (operands[1]) & 31;
3411
3412 operands[4] = GEN_INT (32 - shift - start - size);
3413 operands[1] = GEN_INT (start + size - 1);
3414 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3415 }")
3416
3417 (define_insn "*insvsi_internal4"
3418 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3419 (match_operand:SI 1 "const_int_operand" "i")
3420 (match_operand:SI 2 "const_int_operand" "i"))
3421 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3422 (match_operand:SI 4 "const_int_operand" "i")
3423 (match_operand:SI 5 "const_int_operand" "i")))]
3424 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3425 "*
3426 {
3427 int extract_start = INTVAL (operands[5]) & 31;
3428 int extract_size = INTVAL (operands[4]) & 31;
3429 int insert_start = INTVAL (operands[2]) & 31;
3430 int insert_size = INTVAL (operands[1]) & 31;
3431
3432 /* Align extract field with insert field */
3433 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3434 operands[1] = GEN_INT (insert_start + insert_size - 1);
3435 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
3436 }")
3437
3438 (define_insn "insvdi"
3439 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3440 (match_operand:SI 1 "const_int_operand" "i")
3441 (match_operand:SI 2 "const_int_operand" "i"))
3442 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3443 "TARGET_POWERPC64"
3444 "*
3445 {
3446 int start = INTVAL (operands[2]) & 63;
3447 int size = INTVAL (operands[1]) & 63;
3448
3449 operands[1] = GEN_INT (64 - start - size);
3450 return \"rldimi %0,%3,%H1,%H2\";
3451 }")
3452
3453 (define_expand "extzv"
3454 [(set (match_operand 0 "gpc_reg_operand" "")
3455 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3456 (match_operand:SI 2 "const_int_operand" "")
3457 (match_operand:SI 3 "const_int_operand" "")))]
3458 ""
3459 "
3460 {
3461 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3462 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3463 compiler if the address of the structure is taken later. */
3464 if (GET_CODE (operands[0]) == SUBREG
3465 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3466 FAIL;
3467
3468 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3469 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3470 else
3471 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3472 DONE;
3473 }")
3474
3475 (define_insn "extzvsi"
3476 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3477 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3478 (match_operand:SI 2 "const_int_operand" "i")
3479 (match_operand:SI 3 "const_int_operand" "i")))]
3480 ""
3481 "*
3482 {
3483 int start = INTVAL (operands[3]) & 31;
3484 int size = INTVAL (operands[2]) & 31;
3485
3486 if (start + size >= 32)
3487 operands[3] = const0_rtx;
3488 else
3489 operands[3] = GEN_INT (start + size);
3490 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3491 }")
3492
3493 (define_insn "*extzvsi_internal1"
3494 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3495 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3496 (match_operand:SI 2 "const_int_operand" "i,i")
3497 (match_operand:SI 3 "const_int_operand" "i,i"))
3498 (const_int 0)))
3499 (clobber (match_scratch:SI 4 "=r,r"))]
3500 "! TARGET_POWERPC64"
3501 "*
3502 {
3503 int start = INTVAL (operands[3]) & 31;
3504 int size = INTVAL (operands[2]) & 31;
3505
3506 /* Force split for non-cc0 compare. */
3507 if (which_alternative == 1)
3508 return \"#\";
3509
3510 /* If the bitfield being tested fits in the upper or lower half of a
3511 word, it is possible to use andiu. or andil. to test it. This is
3512 useful because the condition register set-use delay is smaller for
3513 andi[ul]. than for rlinm. This doesn't work when the starting bit
3514 position is 0 because the LT and GT bits may be set wrong. */
3515
3516 if ((start > 0 && start + size <= 16) || start >= 16)
3517 {
3518 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3519 - (1 << (16 - (start & 15) - size))));
3520 if (start < 16)
3521 return \"{andiu.|andis.} %4,%1,%3\";
3522 else
3523 return \"{andil.|andi.} %4,%1,%3\";
3524 }
3525
3526 if (start + size >= 32)
3527 operands[3] = const0_rtx;
3528 else
3529 operands[3] = GEN_INT (start + size);
3530 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3531 }"
3532 [(set_attr "type" "compare")
3533 (set_attr "length" "4,8")])
3534
3535 (define_split
3536 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3537 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3538 (match_operand:SI 2 "const_int_operand" "")
3539 (match_operand:SI 3 "const_int_operand" ""))
3540 (const_int 0)))
3541 (clobber (match_scratch:SI 4 ""))]
3542 "! TARGET_POWERPC64 && reload_completed"
3543 [(set (match_dup 4)
3544 (zero_extract:SI (match_dup 1) (match_dup 2)
3545 (match_dup 3)))
3546 (set (match_dup 0)
3547 (compare:CC (match_dup 4)
3548 (const_int 0)))]
3549 "")
3550
3551 (define_insn "*extzvsi_internal2"
3552 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3553 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3554 (match_operand:SI 2 "const_int_operand" "i,i")
3555 (match_operand:SI 3 "const_int_operand" "i,i"))
3556 (const_int 0)))
3557 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3558 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3559 "! TARGET_POWERPC64"
3560 "*
3561 {
3562 int start = INTVAL (operands[3]) & 31;
3563 int size = INTVAL (operands[2]) & 31;
3564
3565 /* Force split for non-cc0 compare. */
3566 if (which_alternative == 1)
3567 return \"#\";
3568
3569 if (start >= 16 && start + size == 32)
3570 {
3571 operands[3] = GEN_INT ((1 << (32 - start)) - 1);
3572 return \"{andil.|andi.} %0,%1,%3\";
3573 }
3574
3575 if (start + size >= 32)
3576 operands[3] = const0_rtx;
3577 else
3578 operands[3] = GEN_INT (start + size);
3579 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3580 }"
3581 [(set_attr "type" "delayed_compare")
3582 (set_attr "length" "4,8")])
3583
3584 (define_split
3585 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3586 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3587 (match_operand:SI 2 "const_int_operand" "")
3588 (match_operand:SI 3 "const_int_operand" ""))
3589 (const_int 0)))
3590 (set (match_operand:SI 0 "gpc_reg_operand" "")
3591 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3592 "! TARGET_POWERPC64 && reload_completed"
3593 [(set (match_dup 0)
3594 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3595 (set (match_dup 4)
3596 (compare:CC (match_dup 0)
3597 (const_int 0)))]
3598 "")
3599
3600 (define_insn "extzvdi"
3601 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3602 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3603 (match_operand:SI 2 "const_int_operand" "i")
3604 (match_operand:SI 3 "const_int_operand" "i")))]
3605 "TARGET_POWERPC64"
3606 "*
3607 {
3608 int start = INTVAL (operands[3]) & 63;
3609 int size = INTVAL (operands[2]) & 63;
3610
3611 if (start + size >= 64)
3612 operands[3] = const0_rtx;
3613 else
3614 operands[3] = GEN_INT (start + size);
3615 operands[2] = GEN_INT (64 - size);
3616 return \"rldicl %0,%1,%3,%2\";
3617 }")
3618
3619 (define_insn "*extzvdi_internal1"
3620 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3621 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3622 (match_operand:SI 2 "const_int_operand" "i")
3623 (match_operand:SI 3 "const_int_operand" "i"))
3624 (const_int 0)))
3625 (clobber (match_scratch:DI 4 "=r"))]
3626 "TARGET_POWERPC64"
3627 "*
3628 {
3629 int start = INTVAL (operands[3]) & 63;
3630 int size = INTVAL (operands[2]) & 63;
3631
3632 if (start + size >= 64)
3633 operands[3] = const0_rtx;
3634 else
3635 operands[3] = GEN_INT (start + size);
3636 operands[2] = GEN_INT (64 - size);
3637 return \"rldicl. %4,%1,%3,%2\";
3638 }")
3639
3640 (define_insn "*extzvdi_internal2"
3641 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3642 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3643 (match_operand:SI 2 "const_int_operand" "i")
3644 (match_operand:SI 3 "const_int_operand" "i"))
3645 (const_int 0)))
3646 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3647 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3648 "TARGET_POWERPC64"
3649 "*
3650 {
3651 int start = INTVAL (operands[3]) & 63;
3652 int size = INTVAL (operands[2]) & 63;
3653
3654 if (start + size >= 64)
3655 operands[3] = const0_rtx;
3656 else
3657 operands[3] = GEN_INT (start + size);
3658 operands[2] = GEN_INT (64 - size);
3659 return \"rldicl. %0,%1,%3,%2\";
3660 }")
3661
3662 (define_insn "rotlsi3"
3663 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3664 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3665 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3666 ""
3667 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
3668
3669 (define_insn "*rotlsi3_internal2"
3670 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3671 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3672 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3673 (const_int 0)))
3674 (clobber (match_scratch:SI 3 "=r,r"))]
3675 "! TARGET_POWERPC64"
3676 "@
3677 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff
3678 #"
3679 [(set_attr "type" "delayed_compare")
3680 (set_attr "length" "4,8")])
3681
3682 (define_split
3683 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3684 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3685 (match_operand:SI 2 "reg_or_cint_operand" ""))
3686 (const_int 0)))
3687 (clobber (match_scratch:SI 3 ""))]
3688 "! TARGET_POWERPC64 && reload_completed"
3689 [(set (match_dup 3)
3690 (rotate:SI (match_dup 1) (match_dup 2)))
3691 (set (match_dup 0)
3692 (compare:CC (match_dup 3)
3693 (const_int 0)))]
3694 "")
3695
3696 (define_insn "*rotlsi3_internal3"
3697 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3698 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3699 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3700 (const_int 0)))
3701 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3702 (rotate:SI (match_dup 1) (match_dup 2)))]
3703 "! TARGET_POWERPC64"
3704 "@
3705 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff
3706 #"
3707 [(set_attr "type" "delayed_compare")
3708 (set_attr "length" "4,8")])
3709
3710 (define_split
3711 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3712 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3713 (match_operand:SI 2 "reg_or_cint_operand" ""))
3714 (const_int 0)))
3715 (set (match_operand:SI 0 "gpc_reg_operand" "")
3716 (rotate:SI (match_dup 1) (match_dup 2)))]
3717 "! TARGET_POWERPC64 && reload_completed"
3718 [(set (match_dup 0)
3719 (rotate:SI (match_dup 1) (match_dup 2)))
3720 (set (match_dup 3)
3721 (compare:CC (match_dup 0)
3722 (const_int 0)))]
3723 "")
3724
3725 (define_insn "*rotlsi3_internal4"
3726 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3727 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3728 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
3729 (match_operand:SI 3 "mask_operand" "T")))]
3730 ""
3731 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
3732
3733 (define_insn "*rotlsi3_internal5"
3734 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3735 (compare:CC (and:SI
3736 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3737 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3738 (match_operand:SI 3 "mask_operand" "T,T"))
3739 (const_int 0)))
3740 (clobber (match_scratch:SI 4 "=r,r"))]
3741 "! TARGET_POWERPC64"
3742 "@
3743 {rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3
3744 #"
3745 [(set_attr "type" "delayed_compare")
3746 (set_attr "length" "4,8")])
3747
3748 (define_split
3749 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3750 (compare:CC (and:SI
3751 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3752 (match_operand:SI 2 "reg_or_cint_operand" ""))
3753 (match_operand:SI 3 "mask_operand" ""))
3754 (const_int 0)))
3755 (clobber (match_scratch:SI 4 ""))]
3756 "! TARGET_POWERPC64 && reload_completed"
3757 [(set (match_dup 4)
3758 (and:SI (rotate:SI (match_dup 1)
3759 (match_dup 2))
3760 (match_dup 3)))
3761 (set (match_dup 0)
3762 (compare:CC (match_dup 4)
3763 (const_int 0)))]
3764 "")
3765
3766 (define_insn "*rotlsi3_internal6"
3767 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3768 (compare:CC (and:SI
3769 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3770 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3771 (match_operand:SI 3 "mask_operand" "T,T"))
3772 (const_int 0)))
3773 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3774 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3775 "! TARGET_POWERPC64"
3776 "@
3777 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3
3778 #"
3779 [(set_attr "type" "delayed_compare")
3780 (set_attr "length" "4,8")])
3781
3782 (define_split
3783 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3784 (compare:CC (and:SI
3785 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3786 (match_operand:SI 2 "reg_or_cint_operand" ""))
3787 (match_operand:SI 3 "mask_operand" ""))
3788 (const_int 0)))
3789 (set (match_operand:SI 0 "gpc_reg_operand" "")
3790 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3791 "! TARGET_POWERPC64 && reload_completed"
3792 [(set (match_dup 0)
3793 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3794 (set (match_dup 4)
3795 (compare:CC (match_dup 0)
3796 (const_int 0)))]
3797 "")
3798
3799 (define_insn "*rotlsi3_internal7"
3800 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3801 (zero_extend:SI
3802 (subreg:QI
3803 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3804 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3805 ""
3806 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
3807
3808 (define_insn "*rotlsi3_internal8"
3809 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3810 (compare:CC (zero_extend:SI
3811 (subreg:QI
3812 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3813 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3814 (const_int 0)))
3815 (clobber (match_scratch:SI 3 "=r,r"))]
3816 ""
3817 "@
3818 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff
3819 #"
3820 [(set_attr "type" "delayed_compare")
3821 (set_attr "length" "4,8")])
3822
3823 (define_split
3824 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3825 (compare:CC (zero_extend:SI
3826 (subreg:QI
3827 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3828 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3829 (const_int 0)))
3830 (clobber (match_scratch:SI 3 ""))]
3831 "reload_completed"
3832 [(set (match_dup 3)
3833 (zero_extend:SI (subreg:QI
3834 (rotate:SI (match_dup 1)
3835 (match_dup 2)) 0)))
3836 (set (match_dup 0)
3837 (compare:CC (match_dup 3)
3838 (const_int 0)))]
3839 "")
3840
3841 (define_insn "*rotlsi3_internal9"
3842 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3843 (compare:CC (zero_extend:SI
3844 (subreg:QI
3845 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3846 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3847 (const_int 0)))
3848 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3849 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3850 ""
3851 "@
3852 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff
3853 #"
3854 [(set_attr "type" "delayed_compare")
3855 (set_attr "length" "4,8")])
3856
3857 (define_split
3858 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3859 (compare:CC (zero_extend:SI
3860 (subreg:QI
3861 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3862 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3863 (const_int 0)))
3864 (set (match_operand:SI 0 "gpc_reg_operand" "")
3865 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3866 "reload_completed"
3867 [(set (match_dup 0)
3868 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3869 (set (match_dup 3)
3870 (compare:CC (match_dup 0)
3871 (const_int 0)))]
3872 "")
3873
3874 (define_insn "*rotlsi3_internal10"
3875 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3876 (zero_extend:SI
3877 (subreg:HI
3878 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3879 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3880 ""
3881 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
3882
3883 (define_insn "*rotlsi3_internal11"
3884 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3885 (compare:CC (zero_extend:SI
3886 (subreg:HI
3887 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3888 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3889 (const_int 0)))
3890 (clobber (match_scratch:SI 3 "=r,r"))]
3891 ""
3892 "@
3893 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff
3894 #"
3895 [(set_attr "type" "delayed_compare")
3896 (set_attr "length" "4,8")])
3897
3898 (define_split
3899 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3900 (compare:CC (zero_extend:SI
3901 (subreg:HI
3902 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3903 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3904 (const_int 0)))
3905 (clobber (match_scratch:SI 3 ""))]
3906 "reload_completed"
3907 [(set (match_dup 3)
3908 (zero_extend:SI (subreg:HI
3909 (rotate:SI (match_dup 1)
3910 (match_dup 2)) 0)))
3911 (set (match_dup 0)
3912 (compare:CC (match_dup 3)
3913 (const_int 0)))]
3914 "")
3915
3916 (define_insn "*rotlsi3_internal12"
3917 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3918 (compare:CC (zero_extend:SI
3919 (subreg:HI
3920 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3921 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3922 (const_int 0)))
3923 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3924 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3925 ""
3926 "@
3927 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff
3928 #"
3929 [(set_attr "type" "delayed_compare")
3930 (set_attr "length" "4,8")])
3931
3932 (define_split
3933 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3934 (compare:CC (zero_extend:SI
3935 (subreg:HI
3936 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3937 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3938 (const_int 0)))
3939 (set (match_operand:SI 0 "gpc_reg_operand" "")
3940 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3941 "reload_completed"
3942 [(set (match_dup 0)
3943 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3944 (set (match_dup 3)
3945 (compare:CC (match_dup 0)
3946 (const_int 0)))]
3947 "")
3948
3949 ;; Note that we use "sle." instead of "sl." so that we can set
3950 ;; SHIFT_COUNT_TRUNCATED.
3951
3952 (define_expand "ashlsi3"
3953 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3954 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3955 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3956 ""
3957 "
3958 {
3959 if (TARGET_POWER)
3960 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
3961 else
3962 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
3963 DONE;
3964 }")
3965
3966 (define_insn "ashlsi3_power"
3967 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3968 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3969 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
3970 (clobber (match_scratch:SI 3 "=q,X"))]
3971 "TARGET_POWER"
3972 "@
3973 sle %0,%1,%2
3974 {sli|slwi} %0,%1,%h2")
3975
3976 (define_insn "ashlsi3_no_power"
3977 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3978 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3979 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3980 "! TARGET_POWER"
3981 "{sl|slw}%I2 %0,%1,%h2")
3982
3983 (define_insn ""
3984 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3985 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3986 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3987 (const_int 0)))
3988 (clobber (match_scratch:SI 3 "=r,r,r,r"))
3989 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
3990 "TARGET_POWER"
3991 "@
3992 sle. %3,%1,%2
3993 {sli.|slwi.} %3,%1,%h2
3994 #
3995 #"
3996 [(set_attr "type" "delayed_compare")
3997 (set_attr "length" "4,4,8,8")])
3998
3999 (define_split
4000 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4001 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4002 (match_operand:SI 2 "reg_or_cint_operand" ""))
4003 (const_int 0)))
4004 (clobber (match_scratch:SI 3 ""))
4005 (clobber (match_scratch:SI 4 ""))]
4006 "TARGET_POWER && reload_completed"
4007 [(parallel [(set (match_dup 3)
4008 (ashift:SI (match_dup 1) (match_dup 2)))
4009 (clobber (match_dup 4))])
4010 (set (match_dup 0)
4011 (compare:CC (match_dup 3)
4012 (const_int 0)))]
4013 "")
4014
4015 (define_insn ""
4016 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4017 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4018 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4019 (const_int 0)))
4020 (clobber (match_scratch:SI 3 "=r,r"))]
4021 "! TARGET_POWER && ! TARGET_POWERPC64"
4022 "@
4023 {sl|slw}%I2. %3,%1,%h2
4024 #"
4025 [(set_attr "type" "delayed_compare")
4026 (set_attr "length" "4,8")])
4027
4028 (define_split
4029 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4030 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4031 (match_operand:SI 2 "reg_or_cint_operand" ""))
4032 (const_int 0)))
4033 (clobber (match_scratch:SI 3 ""))]
4034 "! TARGET_POWER && ! TARGET_POWERPC64 && reload_completed"
4035 [(set (match_dup 3)
4036 (ashift:SI (match_dup 1) (match_dup 2)))
4037 (set (match_dup 0)
4038 (compare:CC (match_dup 3)
4039 (const_int 0)))]
4040 "")
4041
4042 (define_insn ""
4043 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4044 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4045 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4046 (const_int 0)))
4047 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4048 (ashift:SI (match_dup 1) (match_dup 2)))
4049 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4050 "TARGET_POWER"
4051 "@
4052 sle. %0,%1,%2
4053 {sli.|slwi.} %0,%1,%h2
4054 #
4055 #"
4056 [(set_attr "type" "delayed_compare")
4057 (set_attr "length" "4,4,8,8")])
4058
4059 (define_split
4060 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4061 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4062 (match_operand:SI 2 "reg_or_cint_operand" ""))
4063 (const_int 0)))
4064 (set (match_operand:SI 0 "gpc_reg_operand" "")
4065 (ashift:SI (match_dup 1) (match_dup 2)))
4066 (clobber (match_scratch:SI 4 ""))]
4067 "TARGET_POWER && reload_completed"
4068 [(parallel [(set (match_dup 0)
4069 (ashift:SI (match_dup 1) (match_dup 2)))
4070 (clobber (match_dup 4))])
4071 (set (match_dup 3)
4072 (compare:CC (match_dup 0)
4073 (const_int 0)))]
4074 "")
4075
4076 (define_insn ""
4077 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4078 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4079 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4080 (const_int 0)))
4081 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4082 (ashift:SI (match_dup 1) (match_dup 2)))]
4083 "! TARGET_POWER && ! TARGET_POWERPC64"
4084 "@
4085 {sl|slw}%I2. %0,%1,%h2
4086 #"
4087 [(set_attr "type" "delayed_compare")
4088 (set_attr "length" "4,8")])
4089
4090 (define_split
4091 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4092 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4093 (match_operand:SI 2 "reg_or_cint_operand" ""))
4094 (const_int 0)))
4095 (set (match_operand:SI 0 "gpc_reg_operand" "")
4096 (ashift:SI (match_dup 1) (match_dup 2)))]
4097 "! TARGET_POWER && ! TARGET_POWERPC64 && reload_completed"
4098 [(set (match_dup 0)
4099 (ashift:SI (match_dup 1) (match_dup 2)))
4100 (set (match_dup 3)
4101 (compare:CC (match_dup 0)
4102 (const_int 0)))]
4103 "")
4104
4105 (define_insn ""
4106 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4107 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4108 (match_operand:SI 2 "const_int_operand" "i"))
4109 (match_operand:SI 3 "mask_operand" "T")))]
4110 "includes_lshift_p (operands[2], operands[3])"
4111 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
4112
4113 (define_insn ""
4114 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4115 (compare:CC
4116 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4117 (match_operand:SI 2 "const_int_operand" "i,i"))
4118 (match_operand:SI 3 "mask_operand" "T,T"))
4119 (const_int 0)))
4120 (clobber (match_scratch:SI 4 "=r,r"))]
4121 "! TARGET_POWERPC64 && includes_lshift_p (operands[2], operands[3])"
4122 "@
4123 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4124 #"
4125 [(set_attr "type" "delayed_compare")
4126 (set_attr "length" "4,8")])
4127
4128 (define_split
4129 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4130 (compare:CC
4131 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4132 (match_operand:SI 2 "const_int_operand" ""))
4133 (match_operand:SI 3 "mask_operand" ""))
4134 (const_int 0)))
4135 (clobber (match_scratch:SI 4 ""))]
4136 "! TARGET_POWERPC64 && includes_lshift_p (operands[2], operands[3]) && reload_completed"
4137 [(set (match_dup 4)
4138 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4139 (match_dup 3)))
4140 (set (match_dup 0)
4141 (compare:CC (match_dup 4)
4142 (const_int 0)))]
4143 "")
4144
4145 (define_insn ""
4146 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4147 (compare:CC
4148 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4149 (match_operand:SI 2 "const_int_operand" "i,i"))
4150 (match_operand:SI 3 "mask_operand" "T,T"))
4151 (const_int 0)))
4152 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4153 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4154 "! TARGET_POWERPC64 && includes_lshift_p (operands[2], operands[3])"
4155 "@
4156 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4157 #"
4158 [(set_attr "type" "delayed_compare")
4159 (set_attr "length" "4,8")])
4160
4161 (define_split
4162 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4163 (compare:CC
4164 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4165 (match_operand:SI 2 "const_int_operand" ""))
4166 (match_operand:SI 3 "mask_operand" ""))
4167 (const_int 0)))
4168 (set (match_operand:SI 0 "gpc_reg_operand" "")
4169 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4170 "! TARGET_POWERPC64 && includes_lshift_p (operands[2], operands[3]) && reload_completed"
4171 [(set (match_dup 0)
4172 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4173 (set (match_dup 4)
4174 (compare:CC (match_dup 0)
4175 (const_int 0)))]
4176 "")
4177
4178 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
4179 ;; "sli x,x,0".
4180 (define_expand "lshrsi3"
4181 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4182 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4183 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4184 ""
4185 "
4186 {
4187 if (TARGET_POWER)
4188 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
4189 else
4190 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
4191 DONE;
4192 }")
4193
4194 (define_insn "lshrsi3_power"
4195 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4196 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4197 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
4198 (clobber (match_scratch:SI 3 "=q,X,X"))]
4199 "TARGET_POWER"
4200 "@
4201 sre %0,%1,%2
4202 mr %0,%1
4203 {s%A2i|s%A2wi} %0,%1,%h2")
4204
4205 (define_insn "lshrsi3_no_power"
4206 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4207 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4208 (match_operand:SI 2 "reg_or_cint_operand" "O,ri")))]
4209 "! TARGET_POWER"
4210 "@
4211 mr %0,%1
4212 {sr|srw}%I2 %0,%1,%h2")
4213
4214 (define_insn ""
4215 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4216 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4217 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4218 (const_int 0)))
4219 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
4220 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4221 "TARGET_POWER"
4222 "@
4223 sre. %3,%1,%2
4224 mr. %1,%1
4225 {s%A2i.|s%A2wi.} %3,%1,%h2
4226 #
4227 #
4228 #"
4229 [(set_attr "type" "delayed_compare")
4230 (set_attr "length" "4,4,4,8,8,8")])
4231
4232 (define_split
4233 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4234 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4235 (match_operand:SI 2 "reg_or_cint_operand" ""))
4236 (const_int 0)))
4237 (clobber (match_scratch:SI 3 ""))
4238 (clobber (match_scratch:SI 4 ""))]
4239 "TARGET_POWER && reload_completed"
4240 [(parallel [(set (match_dup 3)
4241 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4242 (clobber (match_dup 4))])
4243 (set (match_dup 0)
4244 (compare:CC (match_dup 3)
4245 (const_int 0)))]
4246 "")
4247
4248 (define_insn ""
4249 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4250 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4251 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
4252 (const_int 0)))
4253 (clobber (match_scratch:SI 3 "=X,r,X,r"))]
4254 "! TARGET_POWER && ! TARGET_POWERPC64"
4255 "@
4256 mr. %1,%1
4257 {sr|srw}%I2. %3,%1,%h2
4258 #
4259 #"
4260 [(set_attr "type" "delayed_compare")
4261 (set_attr "length" "4,4,8,8")])
4262
4263 (define_split
4264 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4265 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4266 (match_operand:SI 2 "reg_or_cint_operand" ""))
4267 (const_int 0)))
4268 (clobber (match_scratch:SI 3 ""))]
4269 "! TARGET_POWER && ! TARGET_POWERPC64 && reload_completed"
4270 [(set (match_dup 3)
4271 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4272 (set (match_dup 0)
4273 (compare:CC (match_dup 3)
4274 (const_int 0)))]
4275 "")
4276
4277 (define_insn ""
4278 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4279 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4280 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4281 (const_int 0)))
4282 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4283 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4284 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4285 "TARGET_POWER"
4286 "@
4287 sre. %0,%1,%2
4288 mr. %0,%1
4289 {s%A2i.|s%A2wi.} %0,%1,%h2
4290 #
4291 #
4292 #"
4293 [(set_attr "type" "delayed_compare")
4294 (set_attr "length" "4,4,4,8,8,8")])
4295
4296 (define_split
4297 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4298 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4299 (match_operand:SI 2 "reg_or_cint_operand" ""))
4300 (const_int 0)))
4301 (set (match_operand:SI 0 "gpc_reg_operand" "")
4302 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4303 (clobber (match_scratch:SI 4 ""))]
4304 "TARGET_POWER && reload_completed"
4305 [(parallel [(set (match_dup 0)
4306 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4307 (clobber (match_dup 4))])
4308 (set (match_dup 3)
4309 (compare:CC (match_dup 0)
4310 (const_int 0)))]
4311 "")
4312
4313 (define_insn ""
4314 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4315 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4316 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
4317 (const_int 0)))
4318 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4319 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4320 "! TARGET_POWER && ! TARGET_POWERPC64"
4321 "@
4322 mr. %0,%1
4323 {sr|srw}%I2. %0,%1,%h2
4324 #
4325 #"
4326 [(set_attr "type" "delayed_compare")
4327 (set_attr "length" "4,4,8,8")])
4328
4329 (define_split
4330 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4331 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4332 (match_operand:SI 2 "reg_or_cint_operand" ""))
4333 (const_int 0)))
4334 (set (match_operand:SI 0 "gpc_reg_operand" "")
4335 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4336 "! TARGET_POWER && ! TARGET_POWERPC64 && reload_completed"
4337 [(set (match_dup 0)
4338 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4339 (set (match_dup 3)
4340 (compare:CC (match_dup 0)
4341 (const_int 0)))]
4342 "")
4343
4344 (define_insn ""
4345 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4346 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4347 (match_operand:SI 2 "const_int_operand" "i"))
4348 (match_operand:SI 3 "mask_operand" "T")))]
4349 "includes_rshift_p (operands[2], operands[3])"
4350 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
4351
4352 (define_insn ""
4353 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4354 (compare:CC
4355 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4356 (match_operand:SI 2 "const_int_operand" "i,i"))
4357 (match_operand:SI 3 "mask_operand" "T,T"))
4358 (const_int 0)))
4359 (clobber (match_scratch:SI 4 "=r,r"))]
4360 "! TARGET_POWERPC64 && includes_rshift_p (operands[2], operands[3])"
4361 "@
4362 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
4363 #"
4364 [(set_attr "type" "delayed_compare")
4365 (set_attr "length" "4,8")])
4366
4367 (define_split
4368 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4369 (compare:CC
4370 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4371 (match_operand:SI 2 "const_int_operand" ""))
4372 (match_operand:SI 3 "mask_operand" ""))
4373 (const_int 0)))
4374 (clobber (match_scratch:SI 4 ""))]
4375 "! TARGET_POWERPC64 && includes_rshift_p (operands[2], operands[3]) && reload_completed"
4376 [(set (match_dup 4)
4377 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4378 (match_dup 3)))
4379 (set (match_dup 0)
4380 (compare:CC (match_dup 4)
4381 (const_int 0)))]
4382 "")
4383
4384 (define_insn ""
4385 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4386 (compare:CC
4387 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4388 (match_operand:SI 2 "const_int_operand" "i,i"))
4389 (match_operand:SI 3 "mask_operand" "T,T"))
4390 (const_int 0)))
4391 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4392 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4393 "! TARGET_POWERPC64 && includes_rshift_p (operands[2], operands[3])"
4394 "@
4395 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
4396 #"
4397 [(set_attr "type" "delayed_compare")
4398 (set_attr "length" "4,8")])
4399
4400 (define_split
4401 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4402 (compare:CC
4403 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4404 (match_operand:SI 2 "const_int_operand" ""))
4405 (match_operand:SI 3 "mask_operand" ""))
4406 (const_int 0)))
4407 (set (match_operand:SI 0 "gpc_reg_operand" "")
4408 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4409 "! TARGET_POWERPC64 && includes_rshift_p (operands[2], operands[3]) && reload_completed"
4410 [(set (match_dup 0)
4411 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4412 (set (match_dup 4)
4413 (compare:CC (match_dup 0)
4414 (const_int 0)))]
4415 "")
4416
4417 (define_insn ""
4418 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4419 (zero_extend:SI
4420 (subreg:QI
4421 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4422 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4423 "includes_rshift_p (operands[2], GEN_INT (255))"
4424 "{rlinm|rlwinm} %0,%1,%s2,0xff")
4425
4426 (define_insn ""
4427 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4428 (compare:CC
4429 (zero_extend:SI
4430 (subreg:QI
4431 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4432 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4433 (const_int 0)))
4434 (clobber (match_scratch:SI 3 "=r,r"))]
4435 "includes_rshift_p (operands[2], GEN_INT (255))"
4436 "@
4437 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4438 #"
4439 [(set_attr "type" "delayed_compare")
4440 (set_attr "length" "4,8")])
4441
4442 (define_split
4443 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4444 (compare:CC
4445 (zero_extend:SI
4446 (subreg:QI
4447 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4448 (match_operand:SI 2 "const_int_operand" "")) 0))
4449 (const_int 0)))
4450 (clobber (match_scratch:SI 3 ""))]
4451 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4452 [(set (match_dup 3)
4453 (zero_extend:SI (subreg:QI
4454 (lshiftrt:SI (match_dup 1)
4455 (match_dup 2)) 0)))
4456 (set (match_dup 0)
4457 (compare:CC (match_dup 3)
4458 (const_int 0)))]
4459 "")
4460
4461 (define_insn ""
4462 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4463 (compare:CC
4464 (zero_extend:SI
4465 (subreg:QI
4466 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4467 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4468 (const_int 0)))
4469 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4470 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4471 "includes_rshift_p (operands[2], GEN_INT (255))"
4472 "@
4473 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4474 #"
4475 [(set_attr "type" "delayed_compare")
4476 (set_attr "length" "4,8")])
4477
4478 (define_split
4479 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4480 (compare:CC
4481 (zero_extend:SI
4482 (subreg:QI
4483 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4484 (match_operand:SI 2 "const_int_operand" "")) 0))
4485 (const_int 0)))
4486 (set (match_operand:SI 0 "gpc_reg_operand" "")
4487 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4488 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4489 [(set (match_dup 0)
4490 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4491 (set (match_dup 3)
4492 (compare:CC (match_dup 0)
4493 (const_int 0)))]
4494 "")
4495
4496 (define_insn ""
4497 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4498 (zero_extend:SI
4499 (subreg:HI
4500 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4501 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4502 "includes_rshift_p (operands[2], GEN_INT (65535))"
4503 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4504
4505 (define_insn ""
4506 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4507 (compare:CC
4508 (zero_extend:SI
4509 (subreg:HI
4510 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4511 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4512 (const_int 0)))
4513 (clobber (match_scratch:SI 3 "=r,r"))]
4514 "includes_rshift_p (operands[2], GEN_INT (65535))"
4515 "@
4516 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4517 #"
4518 [(set_attr "type" "delayed_compare")
4519 (set_attr "length" "4,8")])
4520
4521 (define_split
4522 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4523 (compare:CC
4524 (zero_extend:SI
4525 (subreg:HI
4526 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4527 (match_operand:SI 2 "const_int_operand" "")) 0))
4528 (const_int 0)))
4529 (clobber (match_scratch:SI 3 ""))]
4530 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4531 [(set (match_dup 3)
4532 (zero_extend:SI (subreg:HI
4533 (lshiftrt:SI (match_dup 1)
4534 (match_dup 2)) 0)))
4535 (set (match_dup 0)
4536 (compare:CC (match_dup 3)
4537 (const_int 0)))]
4538 "")
4539
4540 (define_insn ""
4541 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4542 (compare:CC
4543 (zero_extend:SI
4544 (subreg:HI
4545 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4546 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4547 (const_int 0)))
4548 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4549 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4550 "includes_rshift_p (operands[2], GEN_INT (65535))"
4551 "@
4552 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4553 #"
4554 [(set_attr "type" "delayed_compare")
4555 (set_attr "length" "4,8")])
4556
4557 (define_split
4558 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4559 (compare:CC
4560 (zero_extend:SI
4561 (subreg:HI
4562 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4563 (match_operand:SI 2 "const_int_operand" "")) 0))
4564 (const_int 0)))
4565 (set (match_operand:SI 0 "gpc_reg_operand" "")
4566 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4567 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4568 [(set (match_dup 0)
4569 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4570 (set (match_dup 3)
4571 (compare:CC (match_dup 0)
4572 (const_int 0)))]
4573 "")
4574
4575 (define_insn ""
4576 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4577 (const_int 1)
4578 (match_operand:SI 1 "gpc_reg_operand" "r"))
4579 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4580 (const_int 31)))]
4581 "TARGET_POWER"
4582 "rrib %0,%1,%2")
4583
4584 (define_insn ""
4585 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4586 (const_int 1)
4587 (match_operand:SI 1 "gpc_reg_operand" "r"))
4588 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4589 (const_int 31)))]
4590 "TARGET_POWER"
4591 "rrib %0,%1,%2")
4592
4593 (define_insn ""
4594 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4595 (const_int 1)
4596 (match_operand:SI 1 "gpc_reg_operand" "r"))
4597 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4598 (const_int 1)
4599 (const_int 0)))]
4600 "TARGET_POWER"
4601 "rrib %0,%1,%2")
4602
4603 (define_expand "ashrsi3"
4604 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4605 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4606 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4607 ""
4608 "
4609 {
4610 if (TARGET_POWER)
4611 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4612 else
4613 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4614 DONE;
4615 }")
4616
4617 (define_insn "ashrsi3_power"
4618 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4619 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4620 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4621 (clobber (match_scratch:SI 3 "=q,X"))]
4622 "TARGET_POWER"
4623 "@
4624 srea %0,%1,%2
4625 {srai|srawi} %0,%1,%h2")
4626
4627 (define_insn "ashrsi3_no_power"
4628 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4629 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4630 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4631 "! TARGET_POWER"
4632 "{sra|sraw}%I2 %0,%1,%h2")
4633
4634 (define_insn ""
4635 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4636 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4637 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4638 (const_int 0)))
4639 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4640 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4641 "TARGET_POWER"
4642 "@
4643 srea. %3,%1,%2
4644 {srai.|srawi.} %3,%1,%h2
4645 #
4646 #"
4647 [(set_attr "type" "delayed_compare")
4648 (set_attr "length" "4,4,8,8")])
4649
4650 (define_split
4651 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4652 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4653 (match_operand:SI 2 "reg_or_cint_operand" ""))
4654 (const_int 0)))
4655 (clobber (match_scratch:SI 3 ""))
4656 (clobber (match_scratch:SI 4 ""))]
4657 "TARGET_POWER && reload_completed"
4658 [(parallel [(set (match_dup 3)
4659 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4660 (clobber (match_dup 4))])
4661 (set (match_dup 0)
4662 (compare:CC (match_dup 3)
4663 (const_int 0)))]
4664 "")
4665
4666 (define_insn ""
4667 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4668 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4669 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4670 (const_int 0)))
4671 (clobber (match_scratch:SI 3 "=r,r"))]
4672 "! TARGET_POWER"
4673 "@
4674 {sra|sraw}%I2. %3,%1,%h2
4675 #"
4676 [(set_attr "type" "delayed_compare")
4677 (set_attr "length" "4,8")])
4678
4679 (define_split
4680 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4681 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4682 (match_operand:SI 2 "reg_or_cint_operand" ""))
4683 (const_int 0)))
4684 (clobber (match_scratch:SI 3 ""))]
4685 "! TARGET_POWER && reload_completed"
4686 [(set (match_dup 3)
4687 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4688 (set (match_dup 0)
4689 (compare:CC (match_dup 3)
4690 (const_int 0)))]
4691 "")
4692
4693 (define_insn ""
4694 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4695 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4696 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4697 (const_int 0)))
4698 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4699 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4700 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4701 "TARGET_POWER"
4702 "@
4703 srea. %0,%1,%2
4704 {srai.|srawi.} %0,%1,%h2
4705 #
4706 #"
4707 [(set_attr "type" "delayed_compare")
4708 (set_attr "length" "4,4,8,8")])
4709
4710 (define_split
4711 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4712 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4713 (match_operand:SI 2 "reg_or_cint_operand" ""))
4714 (const_int 0)))
4715 (set (match_operand:SI 0 "gpc_reg_operand" "")
4716 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4717 (clobber (match_scratch:SI 4 ""))]
4718 "TARGET_POWER && reload_completed"
4719 [(parallel [(set (match_dup 0)
4720 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4721 (clobber (match_dup 4))])
4722 (set (match_dup 3)
4723 (compare:CC (match_dup 0)
4724 (const_int 0)))]
4725 "")
4726
4727 (define_insn ""
4728 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4729 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4730 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4731 (const_int 0)))
4732 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4733 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4734 "! TARGET_POWER"
4735 "@
4736 {sra|sraw}%I2. %0,%1,%h2
4737 #"
4738 [(set_attr "type" "delayed_compare")
4739 (set_attr "length" "4,8")])
4740 \f
4741 (define_split
4742 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4743 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4744 (match_operand:SI 2 "reg_or_cint_operand" ""))
4745 (const_int 0)))
4746 (set (match_operand:SI 0 "gpc_reg_operand" "")
4747 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4748 "! TARGET_POWER && reload_completed"
4749 [(set (match_dup 0)
4750 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4751 (set (match_dup 3)
4752 (compare:CC (match_dup 0)
4753 (const_int 0)))]
4754 "")
4755
4756 ;; Floating-point insns, excluding normal data motion.
4757 ;;
4758 ;; PowerPC has a full set of single-precision floating point instructions.
4759 ;;
4760 ;; For the POWER architecture, we pretend that we have both SFmode and
4761 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
4762 ;; The only conversions we will do will be when storing to memory. In that
4763 ;; case, we will use the "frsp" instruction before storing.
4764 ;;
4765 ;; Note that when we store into a single-precision memory location, we need to
4766 ;; use the frsp insn first. If the register being stored isn't dead, we
4767 ;; need a scratch register for the frsp. But this is difficult when the store
4768 ;; is done by reload. It is not incorrect to do the frsp on the register in
4769 ;; this case, we just lose precision that we would have otherwise gotten but
4770 ;; is not guaranteed. Perhaps this should be tightened up at some point.
4771
4772 (define_insn "extendsfdf2"
4773 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4774 (float_extend:DF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4775 "TARGET_HARD_FLOAT"
4776 "*
4777 {
4778 if (REGNO (operands[0]) == REGNO (operands[1]))
4779 return \"\";
4780 else
4781 return \"fmr %0,%1\";
4782 }"
4783 [(set_attr "type" "fp")])
4784
4785 (define_insn "truncdfsf2"
4786 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4787 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4788 "TARGET_HARD_FLOAT"
4789 "frsp %0,%1"
4790 [(set_attr "type" "fp")])
4791
4792 (define_insn "aux_truncdfsf2"
4793 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4794 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] 0))]
4795 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
4796 "frsp %0,%1"
4797 [(set_attr "type" "fp")])
4798
4799 (define_insn "negsf2"
4800 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4801 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4802 "TARGET_HARD_FLOAT"
4803 "fneg %0,%1"
4804 [(set_attr "type" "fp")])
4805
4806 (define_insn "abssf2"
4807 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4808 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4809 "TARGET_HARD_FLOAT"
4810 "fabs %0,%1"
4811 [(set_attr "type" "fp")])
4812
4813 (define_insn ""
4814 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4815 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
4816 "TARGET_HARD_FLOAT"
4817 "fnabs %0,%1"
4818 [(set_attr "type" "fp")])
4819
4820 (define_expand "addsf3"
4821 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4822 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4823 (match_operand:SF 2 "gpc_reg_operand" "")))]
4824 "TARGET_HARD_FLOAT"
4825 "")
4826
4827 (define_insn ""
4828 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4829 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4830 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4831 "TARGET_POWERPC && TARGET_HARD_FLOAT"
4832 "fadds %0,%1,%2"
4833 [(set_attr "type" "fp")])
4834
4835 (define_insn ""
4836 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4837 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4838 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4839 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
4840 "{fa|fadd} %0,%1,%2"
4841 [(set_attr "type" "fp")])
4842
4843 (define_expand "subsf3"
4844 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4845 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4846 (match_operand:SF 2 "gpc_reg_operand" "")))]
4847 "TARGET_HARD_FLOAT"
4848 "")
4849
4850 (define_insn ""
4851 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4852 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4853 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4854 "TARGET_POWERPC && TARGET_HARD_FLOAT"
4855 "fsubs %0,%1,%2"
4856 [(set_attr "type" "fp")])
4857
4858 (define_insn ""
4859 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4860 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4861 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4862 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
4863 "{fs|fsub} %0,%1,%2"
4864 [(set_attr "type" "fp")])
4865
4866 (define_expand "mulsf3"
4867 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4868 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
4869 (match_operand:SF 2 "gpc_reg_operand" "")))]
4870 "TARGET_HARD_FLOAT"
4871 "")
4872
4873 (define_insn ""
4874 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4875 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4876 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4877 "TARGET_POWERPC && TARGET_HARD_FLOAT"
4878 "fmuls %0,%1,%2"
4879 [(set_attr "type" "fp")])
4880
4881 (define_insn ""
4882 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4883 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4884 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4885 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
4886 "{fm|fmul} %0,%1,%2"
4887 [(set_attr "type" "dmul")])
4888
4889 (define_expand "divsf3"
4890 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4891 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
4892 (match_operand:SF 2 "gpc_reg_operand" "")))]
4893 "TARGET_HARD_FLOAT"
4894 "")
4895
4896 (define_insn ""
4897 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4898 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4899 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4900 "TARGET_POWERPC && TARGET_HARD_FLOAT"
4901 "fdivs %0,%1,%2"
4902 [(set_attr "type" "sdiv")])
4903
4904 (define_insn ""
4905 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4906 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4907 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4908 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
4909 "{fd|fdiv} %0,%1,%2"
4910 [(set_attr "type" "ddiv")])
4911
4912 (define_insn ""
4913 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4914 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4915 (match_operand:SF 2 "gpc_reg_operand" "f"))
4916 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4917 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
4918 "fmadds %0,%1,%2,%3"
4919 [(set_attr "type" "fp")])
4920
4921 (define_insn ""
4922 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4923 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4924 (match_operand:SF 2 "gpc_reg_operand" "f"))
4925 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4926 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
4927 "{fma|fmadd} %0,%1,%2,%3"
4928 [(set_attr "type" "dmul")])
4929
4930 (define_insn ""
4931 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4932 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4933 (match_operand:SF 2 "gpc_reg_operand" "f"))
4934 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4935 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
4936 "fmsubs %0,%1,%2,%3"
4937 [(set_attr "type" "fp")])
4938
4939 (define_insn ""
4940 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4941 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4942 (match_operand:SF 2 "gpc_reg_operand" "f"))
4943 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4944 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
4945 "{fms|fmsub} %0,%1,%2,%3"
4946 [(set_attr "type" "dmul")])
4947
4948 (define_insn ""
4949 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4950 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4951 (match_operand:SF 2 "gpc_reg_operand" "f"))
4952 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4953 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
4954 "fnmadds %0,%1,%2,%3"
4955 [(set_attr "type" "fp")])
4956
4957 (define_insn ""
4958 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4959 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4960 (match_operand:SF 2 "gpc_reg_operand" "f"))
4961 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4962 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
4963 "{fnma|fnmadd} %0,%1,%2,%3"
4964 [(set_attr "type" "dmul")])
4965
4966 (define_insn ""
4967 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4968 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4969 (match_operand:SF 2 "gpc_reg_operand" "f"))
4970 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4971 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
4972 "fnmsubs %0,%1,%2,%3"
4973 [(set_attr "type" "fp")])
4974
4975 (define_insn ""
4976 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4977 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4978 (match_operand:SF 2 "gpc_reg_operand" "f"))
4979 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4980 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
4981 "{fnms|fnmsub} %0,%1,%2,%3"
4982 [(set_attr "type" "dmul")])
4983
4984 (define_expand "sqrtsf2"
4985 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4986 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4987 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT"
4988 "")
4989
4990 (define_insn ""
4991 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4992 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4993 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT"
4994 "fsqrts %0,%1"
4995 [(set_attr "type" "ssqrt")])
4996
4997 (define_insn ""
4998 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4999 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5000 "TARGET_POWER2 && TARGET_HARD_FLOAT"
5001 "fsqrt %0,%1"
5002 [(set_attr "type" "dsqrt")])
5003
5004 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5005 ;; fsel instruction and some auxiliary computations. Then we just have a
5006 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5007 ;; combine.
5008 (define_expand "maxsf3"
5009 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5010 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5011 (match_operand:SF 2 "gpc_reg_operand" ""))
5012 (match_dup 1)
5013 (match_dup 2)))]
5014 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
5015 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5016
5017 (define_expand "minsf3"
5018 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5019 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5020 (match_operand:SF 2 "gpc_reg_operand" ""))
5021 (match_dup 2)
5022 (match_dup 1)))]
5023 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
5024 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5025
5026 (define_split
5027 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5028 (match_operator:SF 3 "min_max_operator"
5029 [(match_operand:SF 1 "gpc_reg_operand" "")
5030 (match_operand:SF 2 "gpc_reg_operand" "")]))]
5031 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
5032 [(const_int 0)]
5033 "
5034 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5035 operands[1], operands[2]);
5036 DONE;
5037 }")
5038
5039 (define_expand "movsfcc"
5040 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5041 (if_then_else:SF (match_operand 1 "comparison_operator" "")
5042 (match_operand:SF 2 "gpc_reg_operand" "")
5043 (match_operand:SF 3 "gpc_reg_operand" "")))]
5044 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
5045 "
5046 {
5047 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5048 DONE;
5049 else
5050 FAIL;
5051 }")
5052
5053 (define_insn "*fselsfsf4"
5054 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5055 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5056 (match_operand:SF 4 "zero_fp_constant" "F"))
5057 (match_operand:SF 2 "gpc_reg_operand" "f")
5058 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5059 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
5060 "fsel %0,%1,%2,%3"
5061 [(set_attr "type" "fp")])
5062
5063 (define_insn "*fseldfsf4"
5064 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5065 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5066 (match_operand:DF 4 "zero_fp_constant" "F"))
5067 (match_operand:SF 2 "gpc_reg_operand" "f")
5068 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5069 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
5070 "fsel %0,%1,%2,%3"
5071 [(set_attr "type" "fp")])
5072
5073 (define_insn "negdf2"
5074 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5075 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5076 "TARGET_HARD_FLOAT"
5077 "fneg %0,%1"
5078 [(set_attr "type" "fp")])
5079
5080 (define_insn "absdf2"
5081 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5082 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5083 "TARGET_HARD_FLOAT"
5084 "fabs %0,%1"
5085 [(set_attr "type" "fp")])
5086
5087 (define_insn ""
5088 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5089 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
5090 "TARGET_HARD_FLOAT"
5091 "fnabs %0,%1"
5092 [(set_attr "type" "fp")])
5093
5094 (define_insn "adddf3"
5095 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5096 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5097 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5098 "TARGET_HARD_FLOAT"
5099 "{fa|fadd} %0,%1,%2"
5100 [(set_attr "type" "fp")])
5101
5102 (define_insn "subdf3"
5103 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5104 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5105 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5106 "TARGET_HARD_FLOAT"
5107 "{fs|fsub} %0,%1,%2"
5108 [(set_attr "type" "fp")])
5109
5110 (define_insn "muldf3"
5111 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5112 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5113 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5114 "TARGET_HARD_FLOAT"
5115 "{fm|fmul} %0,%1,%2"
5116 [(set_attr "type" "dmul")])
5117
5118 (define_insn "divdf3"
5119 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5120 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5121 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5122 "TARGET_HARD_FLOAT"
5123 "{fd|fdiv} %0,%1,%2"
5124 [(set_attr "type" "ddiv")])
5125
5126 (define_insn ""
5127 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5128 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5129 (match_operand:DF 2 "gpc_reg_operand" "f"))
5130 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5131 "TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
5132 "{fma|fmadd} %0,%1,%2,%3"
5133 [(set_attr "type" "dmul")])
5134
5135 (define_insn ""
5136 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5137 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5138 (match_operand:DF 2 "gpc_reg_operand" "f"))
5139 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5140 "TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
5141 "{fms|fmsub} %0,%1,%2,%3"
5142 [(set_attr "type" "dmul")])
5143
5144 (define_insn ""
5145 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5146 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5147 (match_operand:DF 2 "gpc_reg_operand" "f"))
5148 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5149 "TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
5150 "{fnma|fnmadd} %0,%1,%2,%3"
5151 [(set_attr "type" "dmul")])
5152
5153 (define_insn ""
5154 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5155 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5156 (match_operand:DF 2 "gpc_reg_operand" "f"))
5157 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5158 "TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
5159 "{fnms|fnmsub} %0,%1,%2,%3"
5160 [(set_attr "type" "dmul")])
5161
5162 (define_insn "sqrtdf2"
5163 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5164 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5165 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT"
5166 "fsqrt %0,%1"
5167 [(set_attr "type" "dsqrt")])
5168
5169 ;; The conditional move instructions allow us to perform max and min
5170 ;; operations even when
5171
5172 (define_expand "maxdf3"
5173 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5174 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5175 (match_operand:DF 2 "gpc_reg_operand" ""))
5176 (match_dup 1)
5177 (match_dup 2)))]
5178 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
5179 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5180
5181 (define_expand "mindf3"
5182 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5183 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5184 (match_operand:DF 2 "gpc_reg_operand" ""))
5185 (match_dup 2)
5186 (match_dup 1)))]
5187 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
5188 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5189
5190 (define_split
5191 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5192 (match_operator:DF 3 "min_max_operator"
5193 [(match_operand:DF 1 "gpc_reg_operand" "")
5194 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5195 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
5196 [(const_int 0)]
5197 "
5198 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5199 operands[1], operands[2]);
5200 DONE;
5201 }")
5202
5203 (define_expand "movdfcc"
5204 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5205 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5206 (match_operand:DF 2 "gpc_reg_operand" "")
5207 (match_operand:DF 3 "gpc_reg_operand" "")))]
5208 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
5209 "
5210 {
5211 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5212 DONE;
5213 else
5214 FAIL;
5215 }")
5216
5217 (define_insn "*fseldfdf4"
5218 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5219 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5220 (match_operand:DF 4 "zero_fp_constant" "F"))
5221 (match_operand:DF 2 "gpc_reg_operand" "f")
5222 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5223 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
5224 "fsel %0,%1,%2,%3"
5225 [(set_attr "type" "fp")])
5226
5227 (define_insn "*fselsfdf4"
5228 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5229 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5230 (match_operand:SF 4 "zero_fp_constant" "F"))
5231 (match_operand:DF 2 "gpc_reg_operand" "f")
5232 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5233 "TARGET_PPC_GFXOPT"
5234 "fsel %0,%1,%2,%3"
5235 [(set_attr "type" "fp")])
5236 \f
5237 ;; Conversions to and from floating-point.
5238
5239 ; For each of these conversions, there is a define_expand, a define_insn
5240 ; with a '#' template, and a define_split (with C code). The idea is
5241 ; to allow constant folding with the template of the define_insn,
5242 ; then to have the insns split later (between sched1 and final).
5243
5244 (define_expand "floatsidf2"
5245 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5246 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5247 (use (match_dup 2))
5248 (use (match_dup 3))
5249 (clobber (match_dup 4))
5250 (clobber (match_dup 5))
5251 (clobber (match_dup 6))])]
5252 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
5253 "
5254 {
5255 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5256 operands[3] = force_reg (DFmode, rs6000_float_const (\"4503601774854144\", DFmode));
5257 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5258 operands[5] = gen_reg_rtx (DFmode);
5259 operands[6] = gen_reg_rtx (SImode);
5260 }")
5261
5262 (define_insn "*floatsidf2_internal"
5263 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5264 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5265 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5266 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5267 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5268 (clobber (match_operand:DF 5 "gpc_reg_operand" "=f"))
5269 (clobber (match_operand:SI 6 "gpc_reg_operand" "=r"))]
5270 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
5271 "#"
5272 [(set_attr "length" "24")])
5273
5274 (define_split
5275 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5276 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5277 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5278 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5279 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5280 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))
5281 (clobber (match_operand:SI 6 "gpc_reg_operand" ""))]
5282 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
5283 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5284 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5285 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5286 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5287 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5288 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))
5289 (clobber (match_operand:SI 6 "gpc_reg_operand" ""))]
5290 "
5291 {
5292 rtx lowword, highword;
5293 if (GET_CODE (operands[4]) != MEM)
5294 abort();
5295 highword = XEXP (operands[4], 0);
5296 lowword = plus_constant (highword, 4);
5297 if (! WORDS_BIG_ENDIAN)
5298 {
5299 rtx tmp;
5300 tmp = highword; highword = lowword; lowword = tmp;
5301 }
5302
5303 emit_insn (gen_xorsi3 (operands[6], operands[1],
5304 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5305 emit_move_insn (gen_rtx_MEM (SImode, lowword), operands[6]);
5306 emit_move_insn (gen_rtx_MEM (SImode, highword), operands[2]);
5307 emit_move_insn (operands[5], operands[4]);
5308 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5309 DONE;
5310 }")
5311
5312 (define_expand "floatunssidf2"
5313 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5314 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5315 (use (match_dup 2))
5316 (use (match_dup 3))
5317 (clobber (match_dup 4))
5318 (clobber (match_dup 5))])]
5319 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
5320 "
5321 {
5322 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5323 operands[3] = force_reg (DFmode, rs6000_float_const (\"4503599627370496\", DFmode));
5324 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5325 operands[5] = gen_reg_rtx (DFmode);
5326 }")
5327
5328 (define_insn "*floatunssidf2_internal"
5329 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5330 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5331 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5332 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5333 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5334 (clobber (match_operand:DF 5 "gpc_reg_operand" "=f"))]
5335 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
5336 "#"
5337 [(set_attr "length" "20")])
5338
5339 (define_split
5340 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5341 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5342 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5343 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5344 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5345 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))]
5346 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
5347 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5348 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5349 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5350 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5351 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5352 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))]
5353 "
5354 {
5355 rtx lowword, highword;
5356 if (GET_CODE (operands[4]) != MEM)
5357 abort();
5358 highword = XEXP (operands[4], 0);
5359 lowword = plus_constant (highword, 4);
5360 if (! WORDS_BIG_ENDIAN)
5361 {
5362 rtx tmp;
5363 tmp = highword; highword = lowword; lowword = tmp;
5364 }
5365
5366 emit_move_insn (gen_rtx_MEM (SImode, lowword), operands[1]);
5367 emit_move_insn (gen_rtx_MEM (SImode, highword), operands[2]);
5368 emit_move_insn (operands[5], operands[4]);
5369 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5370 DONE;
5371 }")
5372
5373 (define_expand "fix_truncdfsi2"
5374 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
5375 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5376 (clobber (match_dup 2))
5377 (clobber (match_dup 3))])]
5378 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT"
5379 "
5380 {
5381 operands[2] = gen_reg_rtx (DImode);
5382 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5383 }")
5384
5385 (define_insn "*fix_truncdfsi2_internal"
5386 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5387 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5388 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5389 (clobber (match_operand:DI 3 "memory_operand" "=o"))]
5390 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT"
5391 "#"
5392 [(set_attr "length" "16")])
5393
5394 (define_split
5395 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5396 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5397 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
5398 (clobber (match_operand:DI 3 "offsettable_mem_operand" ""))]
5399 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT"
5400 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5401 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5402 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
5403 (clobber (match_operand:DI 3 "offsettable_mem_operand" ""))]
5404 "
5405 {
5406 rtx lowword;
5407 if (GET_CODE (operands[3]) != MEM)
5408 abort();
5409 lowword = XEXP (operands[3], 0);
5410 if (WORDS_BIG_ENDIAN)
5411 lowword = plus_constant (lowword, 4);
5412
5413 emit_insn (gen_fctiwz (operands[2], operands[1]));
5414 emit_move_insn (operands[3], operands[2]);
5415 emit_move_insn (operands[0], gen_rtx_MEM (SImode, lowword));
5416 DONE;
5417 }")
5418
5419 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] 10))
5420 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
5421 ; because the first makes it clear that operand 0 is not live
5422 ; before the instruction.
5423 (define_insn "fctiwz"
5424 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
5425 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))] 10))]
5426 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT"
5427 "{fcirz|fctiwz} %0,%1"
5428 [(set_attr "type" "fp")])
5429
5430 (define_insn "floatdidf2"
5431 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5432 (float:DF (match_operand:DI 1 "gpc_reg_operand" "f")))]
5433 "TARGET_POWERPC64 && TARGET_HARD_FLOAT"
5434 "fcfid %0,%1"
5435 [(set_attr "type" "fp")])
5436
5437 (define_insn "fix_truncdfdi2"
5438 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
5439 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
5440 "TARGET_POWERPC64 && TARGET_HARD_FLOAT"
5441 "fctidz %0,%1"
5442 [(set_attr "type" "fp")])
5443
5444 ;; This only is safe if rounding mode set appropriately.
5445 (define_insn_and_split "floatdisf2"
5446 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5447 (float:SF (match_operand:DI 1 "gpc_reg_operand" "f")))
5448 (clobber (match_scratch:DF 2 "=f"))]
5449 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && flag_unsafe_math_optimizations"
5450 "#"
5451 "&& reload_completed"
5452 [(set (match_dup 2)
5453 (float:DF (match_dup 1)))
5454 (set (match_dup 0)
5455 (float_truncate:SF (match_dup 2)))]
5456 "")
5457 \f
5458 ;; Define the DImode operations that can be done in a small number
5459 ;; of instructions. The & constraints are to prevent the register
5460 ;; allocator from allocating registers that overlap with the inputs
5461 ;; (for example, having an input in 7,8 and an output in 6,7). We
5462 ;; also allow for the output being the same as one of the inputs.
5463
5464 (define_insn "*adddi3_noppc64"
5465 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
5466 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
5467 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
5468 "! TARGET_POWERPC64"
5469 "*
5470 {
5471 if (WORDS_BIG_ENDIAN)
5472 return (GET_CODE (operands[2])) != CONST_INT
5473 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
5474 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
5475 else
5476 return (GET_CODE (operands[2])) != CONST_INT
5477 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
5478 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
5479 }"
5480 [(set_attr "length" "8")])
5481
5482 (define_insn "*subdi3_noppc64"
5483 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
5484 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
5485 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
5486 "! TARGET_POWERPC64"
5487 "*
5488 {
5489 if (WORDS_BIG_ENDIAN)
5490 return (GET_CODE (operands[1]) != CONST_INT)
5491 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
5492 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
5493 else
5494 return (GET_CODE (operands[1]) != CONST_INT)
5495 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
5496 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
5497 }"
5498 [(set_attr "length" "8")])
5499
5500 (define_insn "*negdi2_noppc64"
5501 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5502 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
5503 "! TARGET_POWERPC64"
5504 "*
5505 {
5506 return (WORDS_BIG_ENDIAN)
5507 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
5508 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
5509 }"
5510 [(set_attr "length" "8")])
5511
5512 (define_expand "mulsidi3"
5513 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5514 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5515 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5516 "! TARGET_POWERPC64"
5517 "
5518 {
5519 if (! TARGET_POWER && ! TARGET_POWERPC)
5520 {
5521 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5522 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5523 emit_insn (gen_mull_call ());
5524 if (WORDS_BIG_ENDIAN)
5525 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
5526 else
5527 {
5528 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
5529 gen_rtx_REG (SImode, 3));
5530 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
5531 gen_rtx_REG (SImode, 4));
5532 }
5533 DONE;
5534 }
5535 else if (TARGET_POWER)
5536 {
5537 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
5538 DONE;
5539 }
5540 }")
5541
5542 (define_insn "mulsidi3_mq"
5543 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5544 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5545 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5546 (clobber (match_scratch:SI 3 "=q"))]
5547 "TARGET_POWER"
5548 "mul %0,%1,%2\;mfmq %L0"
5549 [(set_attr "type" "imul")
5550 (set_attr "length" "8")])
5551
5552 (define_insn "*mulsidi3_no_mq"
5553 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5554 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5555 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5556 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5557 "*
5558 {
5559 return (WORDS_BIG_ENDIAN)
5560 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
5561 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
5562 }"
5563 [(set_attr "type" "imul")
5564 (set_attr "length" "8")])
5565
5566 (define_split
5567 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5568 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5569 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5570 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5571 [(set (match_dup 3)
5572 (truncate:SI
5573 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
5574 (sign_extend:DI (match_dup 2)))
5575 (const_int 32))))
5576 (set (match_dup 4)
5577 (mult:SI (match_dup 1)
5578 (match_dup 2)))]
5579 "
5580 {
5581 int endian = (WORDS_BIG_ENDIAN == 0);
5582 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5583 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5584 }")
5585
5586 (define_expand "umulsidi3"
5587 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5588 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5589 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5590 "TARGET_POWERPC && ! TARGET_POWERPC64"
5591 "
5592 {
5593 if (TARGET_POWER)
5594 {
5595 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
5596 DONE;
5597 }
5598 }")
5599
5600 (define_insn "umulsidi3_mq"
5601 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5602 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5603 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5604 (clobber (match_scratch:SI 3 "=q"))]
5605 "TARGET_POWERPC && TARGET_POWER"
5606 "*
5607 {
5608 return (WORDS_BIG_ENDIAN)
5609 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5610 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5611 }"
5612 [(set_attr "type" "imul")
5613 (set_attr "length" "8")])
5614
5615 (define_insn "*umulsidi3_no_mq"
5616 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5617 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5618 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5619 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5620 "*
5621 {
5622 return (WORDS_BIG_ENDIAN)
5623 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5624 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5625 }"
5626 [(set_attr "type" "imul")
5627 (set_attr "length" "8")])
5628
5629 (define_split
5630 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5631 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5632 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5633 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5634 [(set (match_dup 3)
5635 (truncate:SI
5636 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
5637 (zero_extend:DI (match_dup 2)))
5638 (const_int 32))))
5639 (set (match_dup 4)
5640 (mult:SI (match_dup 1)
5641 (match_dup 2)))]
5642 "
5643 {
5644 int endian = (WORDS_BIG_ENDIAN == 0);
5645 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5646 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5647 }")
5648
5649 (define_expand "smulsi3_highpart"
5650 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5651 (truncate:SI
5652 (lshiftrt:DI (mult:DI (sign_extend:DI
5653 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5654 (sign_extend:DI
5655 (match_operand:SI 2 "gpc_reg_operand" "r")))
5656 (const_int 32))))]
5657 ""
5658 "
5659 {
5660 if (! TARGET_POWER && ! TARGET_POWERPC)
5661 {
5662 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5663 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5664 emit_insn (gen_mulh_call ());
5665 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
5666 DONE;
5667 }
5668 else if (TARGET_POWER)
5669 {
5670 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5671 DONE;
5672 }
5673 }")
5674
5675 (define_insn "smulsi3_highpart_mq"
5676 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5677 (truncate:SI
5678 (lshiftrt:DI (mult:DI (sign_extend:DI
5679 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5680 (sign_extend:DI
5681 (match_operand:SI 2 "gpc_reg_operand" "r")))
5682 (const_int 32))))
5683 (clobber (match_scratch:SI 3 "=q"))]
5684 "TARGET_POWER"
5685 "mul %0,%1,%2"
5686 [(set_attr "type" "imul")])
5687
5688 (define_insn "*smulsi3_highpart_no_mq"
5689 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5690 (truncate:SI
5691 (lshiftrt:DI (mult:DI (sign_extend:DI
5692 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5693 (sign_extend:DI
5694 (match_operand:SI 2 "gpc_reg_operand" "r")))
5695 (const_int 32))))]
5696 "TARGET_POWERPC && ! TARGET_POWER"
5697 "mulhw %0,%1,%2"
5698 [(set_attr "type" "imul")])
5699
5700 (define_expand "umulsi3_highpart"
5701 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5702 (truncate:SI
5703 (lshiftrt:DI (mult:DI (zero_extend:DI
5704 (match_operand:SI 1 "gpc_reg_operand" ""))
5705 (zero_extend:DI
5706 (match_operand:SI 2 "gpc_reg_operand" "")))
5707 (const_int 32))))]
5708 "TARGET_POWERPC"
5709 "
5710 {
5711 if (TARGET_POWER)
5712 {
5713 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5714 DONE;
5715 }
5716 }")
5717
5718 (define_insn "umulsi3_highpart_mq"
5719 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5720 (truncate:SI
5721 (lshiftrt:DI (mult:DI (zero_extend:DI
5722 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5723 (zero_extend:DI
5724 (match_operand:SI 2 "gpc_reg_operand" "r")))
5725 (const_int 32))))
5726 (clobber (match_scratch:SI 3 "=q"))]
5727 "TARGET_POWERPC && TARGET_POWER"
5728 "mulhwu %0,%1,%2"
5729 [(set_attr "type" "imul")])
5730
5731 (define_insn "*umulsi3_highpart_no_mq"
5732 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5733 (truncate:SI
5734 (lshiftrt:DI (mult:DI (zero_extend:DI
5735 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5736 (zero_extend:DI
5737 (match_operand:SI 2 "gpc_reg_operand" "r")))
5738 (const_int 32))))]
5739 "TARGET_POWERPC && ! TARGET_POWER"
5740 "mulhwu %0,%1,%2"
5741 [(set_attr "type" "imul")])
5742
5743 ;; If operands 0 and 2 are in the same register, we have a problem. But
5744 ;; operands 0 and 1 (the usual case) can be in the same register. That's
5745 ;; why we have the strange constraints below.
5746 (define_insn "ashldi3_power"
5747 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5748 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5749 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5750 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5751 "TARGET_POWER"
5752 "@
5753 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
5754 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5755 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5756 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
5757 [(set_attr "length" "8")])
5758
5759 (define_insn "lshrdi3_power"
5760 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5761 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5762 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5763 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5764 "TARGET_POWER"
5765 "@
5766 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
5767 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5768 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5769 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
5770 [(set_attr "length" "8")])
5771
5772 ;; Shift by a variable amount is too complex to be worth open-coding. We
5773 ;; just handle shifts by constants.
5774 (define_insn "ashrdi3_power"
5775 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5776 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5777 (match_operand:SI 2 "const_int_operand" "M,i")))
5778 (clobber (match_scratch:SI 3 "=X,q"))]
5779 "TARGET_POWER"
5780 "@
5781 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
5782 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
5783 [(set_attr "length" "8")])
5784 \f
5785 ;; PowerPC64 DImode operations.
5786
5787 (define_expand "adddi3"
5788 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5789 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5790 (match_operand:DI 2 "reg_or_add_cint64_operand" "")))]
5791 ""
5792 "
5793 {
5794 if (! TARGET_POWERPC64)
5795 {
5796 if (non_short_cint_operand (operands[2], DImode))
5797 FAIL;
5798 }
5799 else
5800 if (GET_CODE (operands[2]) == CONST_INT
5801 && ! add_operand (operands[2], DImode))
5802 {
5803 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
5804 ? operands[0] : gen_reg_rtx (DImode));
5805
5806 HOST_WIDE_INT val = INTVAL (operands[2]);
5807 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
5808 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, DImode);
5809
5810 if (!CONST_OK_FOR_LETTER_P (rest, 'L'))
5811 FAIL;
5812
5813 /* The ordering here is important for the prolog expander.
5814 When space is allocated from the stack, adding 'low' first may
5815 produce a temporary deallocation (which would be bad). */
5816 emit_insn (gen_adddi3 (tmp, operands[1], GEN_INT (rest)));
5817 emit_insn (gen_adddi3 (operands[0], tmp, GEN_INT (low)));
5818 DONE;
5819 }
5820 }")
5821
5822 ;; Discourage ai/addic because of carry but provide it in an alternative
5823 ;; allowing register zero as source.
5824
5825 (define_insn "*adddi3_internal1"
5826 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,?r,r")
5827 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,b,r,b")
5828 (match_operand:DI 2 "add_operand" "r,I,I,L")))]
5829 "TARGET_POWERPC64"
5830 "@
5831 add %0,%1,%2
5832 addi %0,%1,%2
5833 addic %0,%1,%2
5834 addis %0,%1,%v2")
5835
5836 (define_insn "*adddi3_internal2"
5837 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5838 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
5839 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
5840 (const_int 0)))
5841 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
5842 "TARGET_POWERPC64"
5843 "@
5844 add. %3,%1,%2
5845 addic. %3,%1,%2
5846 #
5847 #"
5848 [(set_attr "type" "compare")
5849 (set_attr "length" "4,4,8,8")])
5850
5851 (define_split
5852 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5853 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5854 (match_operand:DI 2 "reg_or_short_operand" ""))
5855 (const_int 0)))
5856 (clobber (match_scratch:DI 3 ""))]
5857 "TARGET_POWERPC64 && reload_completed"
5858 [(set (match_dup 3)
5859 (plus:DI (match_dup 1) (match_dup 2)))
5860 (set (match_dup 0)
5861 (compare:CC (match_dup 3)
5862 (const_int 0)))]
5863 "")
5864
5865 (define_insn "*adddi3_internal3"
5866 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5867 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
5868 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
5869 (const_int 0)))
5870 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
5871 (plus:DI (match_dup 1) (match_dup 2)))]
5872 "TARGET_POWERPC64"
5873 "@
5874 add. %0,%1,%2
5875 addic. %0,%1,%2
5876 #
5877 #"
5878 [(set_attr "type" "compare")
5879 (set_attr "length" "4,4,8,8")])
5880
5881 (define_split
5882 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5883 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5884 (match_operand:DI 2 "reg_or_short_operand" ""))
5885 (const_int 0)))
5886 (set (match_operand:DI 0 "gpc_reg_operand" "")
5887 (plus:DI (match_dup 1) (match_dup 2)))]
5888 "TARGET_POWERPC64 && reload_completed"
5889 [(set (match_dup 0)
5890 (plus:DI (match_dup 1) (match_dup 2)))
5891 (set (match_dup 3)
5892 (compare:CC (match_dup 0)
5893 (const_int 0)))]
5894 "")
5895
5896 ;; Split an add that we can't do in one insn into two insns, each of which
5897 ;; does one 16-bit part. This is used by combine. Note that the low-order
5898 ;; add should be last in case the result gets used in an address.
5899
5900 (define_split
5901 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5902 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5903 (match_operand:DI 2 "non_add_cint_operand" "")))]
5904 "TARGET_POWERPC64"
5905 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
5906 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
5907 "
5908 {
5909 HOST_WIDE_INT val = INTVAL (operands[2]);
5910 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
5911 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, DImode);
5912
5913 operands[4] = GEN_INT (low);
5914 if (CONST_OK_FOR_LETTER_P (rest, 'L'))
5915 operands[3] = GEN_INT (rest);
5916 else if (! no_new_pseudos)
5917 {
5918 operands[3] = gen_reg_rtx (DImode);
5919 emit_move_insn (operands[3], operands[2]);
5920 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
5921 DONE;
5922 }
5923 else
5924 FAIL;
5925 }")
5926
5927 (define_insn "one_cmpldi2"
5928 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5929 (not:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
5930 "TARGET_POWERPC64"
5931 "nor %0,%1,%1")
5932
5933 (define_insn ""
5934 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5935 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5936 (const_int 0)))
5937 (clobber (match_scratch:DI 2 "=r,r"))]
5938 "TARGET_POWERPC64"
5939 "@
5940 nor. %2,%1,%1
5941 #"
5942 [(set_attr "type" "compare")
5943 (set_attr "length" "4,8")])
5944
5945 (define_split
5946 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5947 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
5948 (const_int 0)))
5949 (clobber (match_scratch:DI 2 ""))]
5950 "TARGET_POWERPC64 && reload_completed"
5951 [(set (match_dup 2)
5952 (not:DI (match_dup 1)))
5953 (set (match_dup 0)
5954 (compare:CC (match_dup 2)
5955 (const_int 0)))]
5956 "")
5957
5958 (define_insn ""
5959 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
5960 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5961 (const_int 0)))
5962 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5963 (not:DI (match_dup 1)))]
5964 "TARGET_POWERPC64"
5965 "@
5966 nor. %0,%1,%1
5967 #"
5968 [(set_attr "type" "compare")
5969 (set_attr "length" "4,8")])
5970
5971 (define_split
5972 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
5973 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
5974 (const_int 0)))
5975 (set (match_operand:DI 0 "gpc_reg_operand" "")
5976 (not:DI (match_dup 1)))]
5977 "TARGET_POWERPC64 && reload_completed"
5978 [(set (match_dup 0)
5979 (not:DI (match_dup 1)))
5980 (set (match_dup 2)
5981 (compare:CC (match_dup 0)
5982 (const_int 0)))]
5983 "")
5984
5985 (define_insn ""
5986 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5987 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I")
5988 (match_operand:DI 2 "gpc_reg_operand" "r,r")))]
5989 "TARGET_POWERPC64"
5990 "@
5991 subf %0,%2,%1
5992 subfic %0,%2,%1")
5993
5994 (define_insn ""
5995 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5996 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5997 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
5998 (const_int 0)))
5999 (clobber (match_scratch:DI 3 "=r,r"))]
6000 "TARGET_POWERPC64"
6001 "@
6002 subf. %3,%2,%1
6003 #"
6004 [(set_attr "type" "compare")
6005 (set_attr "length" "4,8")])
6006
6007 (define_split
6008 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6009 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6010 (match_operand:DI 2 "gpc_reg_operand" ""))
6011 (const_int 0)))
6012 (clobber (match_scratch:DI 3 ""))]
6013 "TARGET_POWERPC64 && reload_completed"
6014 [(set (match_dup 3)
6015 (minus:DI (match_dup 1) (match_dup 2)))
6016 (set (match_dup 0)
6017 (compare:CC (match_dup 3)
6018 (const_int 0)))]
6019 "")
6020
6021 (define_insn ""
6022 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6023 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6024 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6025 (const_int 0)))
6026 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6027 (minus:DI (match_dup 1) (match_dup 2)))]
6028 "TARGET_POWERPC64"
6029 "@
6030 subf. %0,%2,%1
6031 #"
6032 [(set_attr "type" "compare")
6033 (set_attr "length" "4,8")])
6034
6035 (define_split
6036 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6037 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6038 (match_operand:DI 2 "gpc_reg_operand" ""))
6039 (const_int 0)))
6040 (set (match_operand:DI 0 "gpc_reg_operand" "")
6041 (minus:DI (match_dup 1) (match_dup 2)))]
6042 "TARGET_POWERPC64 && reload_completed"
6043 [(set (match_dup 0)
6044 (minus:DI (match_dup 1) (match_dup 2)))
6045 (set (match_dup 3)
6046 (compare:CC (match_dup 0)
6047 (const_int 0)))]
6048 "")
6049
6050 (define_expand "subdi3"
6051 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6052 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "")
6053 (match_operand:DI 2 "reg_or_sub_cint64_operand" "")))]
6054 ""
6055 "
6056 {
6057 if (GET_CODE (operands[2]) == CONST_INT)
6058 {
6059 emit_insn (gen_adddi3 (operands[0], operands[1],
6060 negate_rtx (DImode, operands[2])));
6061 DONE;
6062 }
6063 }")
6064
6065 (define_insn_and_split "absdi2"
6066 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6067 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
6068 (clobber (match_scratch:DI 2 "=&r,&r"))]
6069 "TARGET_POWERPC64"
6070 "#"
6071 "&& reload_completed"
6072 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6073 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6074 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
6075 "")
6076
6077 (define_insn_and_split "*nabsdi2"
6078 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6079 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
6080 (clobber (match_scratch:DI 2 "=&r,&r"))]
6081 "TARGET_POWERPC64"
6082 "#"
6083 "&& reload_completed"
6084 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6085 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6086 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
6087 "")
6088
6089 (define_expand "negdi2"
6090 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6091 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
6092 ""
6093 "")
6094
6095 (define_insn ""
6096 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6097 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
6098 "TARGET_POWERPC64"
6099 "neg %0,%1")
6100
6101 (define_insn ""
6102 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6103 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6104 (const_int 0)))
6105 (clobber (match_scratch:DI 2 "=r,r"))]
6106 "TARGET_POWERPC64"
6107 "@
6108 neg. %2,%1
6109 #"
6110 [(set_attr "type" "compare")
6111 (set_attr "length" "4,8")])
6112
6113 (define_split
6114 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6115 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6116 (const_int 0)))
6117 (clobber (match_scratch:DI 2 ""))]
6118 "TARGET_POWERPC64 && reload_completed"
6119 [(set (match_dup 2)
6120 (neg:DI (match_dup 1)))
6121 (set (match_dup 0)
6122 (compare:CC (match_dup 2)
6123 (const_int 0)))]
6124 "")
6125
6126 (define_insn ""
6127 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
6128 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6129 (const_int 0)))
6130 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6131 (neg:DI (match_dup 1)))]
6132 "TARGET_POWERPC64"
6133 "@
6134 neg. %0,%1
6135 #"
6136 [(set_attr "type" "compare")
6137 (set_attr "length" "4,8")])
6138
6139 (define_split
6140 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
6141 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6142 (const_int 0)))
6143 (set (match_operand:DI 0 "gpc_reg_operand" "")
6144 (neg:DI (match_dup 1)))]
6145 "TARGET_POWERPC64 && reload_completed"
6146 [(set (match_dup 0)
6147 (neg:DI (match_dup 1)))
6148 (set (match_dup 2)
6149 (compare:CC (match_dup 0)
6150 (const_int 0)))]
6151 "")
6152
6153 (define_insn "ffsdi2"
6154 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6155 (ffs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
6156 "TARGET_POWERPC64"
6157 "neg %0,%1\;and %0,%0,%1\;cntlzd %0,%0\;subfic %0,%0,64"
6158 [(set_attr "length" "16")])
6159
6160 (define_insn "muldi3"
6161 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6162 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
6163 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6164 "TARGET_POWERPC64"
6165 "mulld %0,%1,%2"
6166 [(set_attr "type" "lmul")])
6167
6168 (define_insn "smuldi3_highpart"
6169 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6170 (truncate:DI
6171 (lshiftrt:TI (mult:TI (sign_extend:TI
6172 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6173 (sign_extend:TI
6174 (match_operand:DI 2 "gpc_reg_operand" "r")))
6175 (const_int 64))))]
6176 "TARGET_POWERPC64"
6177 "mulhd %0,%1,%2"
6178 [(set_attr "type" "lmul")])
6179
6180 (define_insn "umuldi3_highpart"
6181 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6182 (truncate:DI
6183 (lshiftrt:TI (mult:TI (zero_extend:TI
6184 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6185 (zero_extend:TI
6186 (match_operand:DI 2 "gpc_reg_operand" "r")))
6187 (const_int 64))))]
6188 "TARGET_POWERPC64"
6189 "mulhdu %0,%1,%2"
6190 [(set_attr "type" "lmul")])
6191
6192 (define_expand "divdi3"
6193 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6194 (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6195 (match_operand:DI 2 "reg_or_cint_operand" "")))]
6196 "TARGET_POWERPC64"
6197 "
6198 {
6199 if (GET_CODE (operands[2]) == CONST_INT
6200 && INTVAL (operands[2]) > 0
6201 && exact_log2 (INTVAL (operands[2])) >= 0)
6202 ;
6203 else
6204 operands[2] = force_reg (DImode, operands[2]);
6205 }")
6206
6207 (define_expand "moddi3"
6208 [(use (match_operand:DI 0 "gpc_reg_operand" ""))
6209 (use (match_operand:DI 1 "gpc_reg_operand" ""))
6210 (use (match_operand:DI 2 "reg_or_cint_operand" ""))]
6211 "TARGET_POWERPC64"
6212 "
6213 {
6214 int i;
6215 rtx temp1;
6216 rtx temp2;
6217
6218 if (GET_CODE (operands[2]) != CONST_INT
6219 || INTVAL (operands[2]) <= 0
6220 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
6221 FAIL;
6222
6223 temp1 = gen_reg_rtx (DImode);
6224 temp2 = gen_reg_rtx (DImode);
6225
6226 emit_insn (gen_divdi3 (temp1, operands[1], operands[2]));
6227 emit_insn (gen_ashldi3 (temp2, temp1, GEN_INT (i)));
6228 emit_insn (gen_subdi3 (operands[0], operands[1], temp2));
6229 DONE;
6230 }")
6231
6232 (define_insn ""
6233 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6234 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6235 (match_operand:DI 2 "exact_log2_cint_operand" "N")))]
6236 "TARGET_POWERPC64"
6237 "sradi %0,%1,%p2\;addze %0,%0"
6238 [(set_attr "length" "8")])
6239
6240 (define_insn ""
6241 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6242 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6243 (match_operand:DI 2 "exact_log2_cint_operand" "N,N"))
6244 (const_int 0)))
6245 (clobber (match_scratch:DI 3 "=r,r"))]
6246 "TARGET_POWERPC64"
6247 "@
6248 sradi %3,%1,%p2\;addze. %3,%3
6249 #"
6250 [(set_attr "type" "compare")
6251 (set_attr "length" "8,12")])
6252
6253 (define_split
6254 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6255 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6256 (match_operand:DI 2 "exact_log2_cint_operand" ""))
6257 (const_int 0)))
6258 (clobber (match_scratch:DI 3 ""))]
6259 "TARGET_POWERPC64 && reload_completed"
6260 [(set (match_dup 3)
6261 (div:DI (match_dup 1) (match_dup 2)))
6262 (set (match_dup 0)
6263 (compare:CC (match_dup 3)
6264 (const_int 0)))]
6265 "")
6266
6267 (define_insn ""
6268 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6269 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6270 (match_operand:DI 2 "exact_log2_cint_operand" "N,N"))
6271 (const_int 0)))
6272 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6273 (div:DI (match_dup 1) (match_dup 2)))]
6274 "TARGET_POWERPC64"
6275 "@
6276 sradi %0,%1,%p2\;addze. %0,%0
6277 #"
6278 [(set_attr "type" "compare")
6279 (set_attr "length" "8,12")])
6280
6281 (define_split
6282 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6283 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6284 (match_operand:DI 2 "exact_log2_cint_operand" ""))
6285 (const_int 0)))
6286 (set (match_operand:DI 0 "gpc_reg_operand" "")
6287 (div:DI (match_dup 1) (match_dup 2)))]
6288 "TARGET_POWERPC64 && reload_completed"
6289 [(set (match_dup 0)
6290 (div:DI (match_dup 1) (match_dup 2)))
6291 (set (match_dup 3)
6292 (compare:CC (match_dup 0)
6293 (const_int 0)))]
6294 "")
6295
6296 (define_insn ""
6297 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6298 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6299 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6300 "TARGET_POWERPC64"
6301 "divd %0,%1,%2"
6302 [(set_attr "type" "ldiv")])
6303
6304 (define_insn "udivdi3"
6305 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6306 (udiv:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6307 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6308 "TARGET_POWERPC64"
6309 "divdu %0,%1,%2"
6310 [(set_attr "type" "ldiv")])
6311
6312 (define_insn "rotldi3"
6313 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6314 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6315 (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
6316 "TARGET_POWERPC64"
6317 "rld%I2cl %0,%1,%H2,0")
6318
6319 (define_insn "*rotldi3_internal2"
6320 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6321 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6322 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6323 (const_int 0)))
6324 (clobber (match_scratch:DI 3 "=r,r"))]
6325 "TARGET_POWERPC64"
6326 "@
6327 rld%I2cl. %3,%1,%H2,0
6328 #"
6329 [(set_attr "type" "delayed_compare")
6330 (set_attr "length" "4,8")])
6331
6332 (define_split
6333 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6334 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6335 (match_operand:DI 2 "reg_or_cint_operand" ""))
6336 (const_int 0)))
6337 (clobber (match_scratch:DI 3 ""))]
6338 "TARGET_POWERPC64 && reload_completed"
6339 [(set (match_dup 3)
6340 (rotate:DI (match_dup 1) (match_dup 2)))
6341 (set (match_dup 0)
6342 (compare:CC (match_dup 3)
6343 (const_int 0)))]
6344 "")
6345
6346 (define_insn "*rotldi3_internal3"
6347 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6348 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6349 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6350 (const_int 0)))
6351 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6352 (rotate:DI (match_dup 1) (match_dup 2)))]
6353 "TARGET_POWERPC64"
6354 "@
6355 rld%I2cl. %0,%1,%H2,0
6356 #"
6357 [(set_attr "type" "delayed_compare")
6358 (set_attr "length" "4,8")])
6359
6360 (define_split
6361 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6362 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6363 (match_operand:DI 2 "reg_or_cint_operand" ""))
6364 (const_int 0)))
6365 (set (match_operand:DI 0 "gpc_reg_operand" "")
6366 (rotate:DI (match_dup 1) (match_dup 2)))]
6367 "TARGET_POWERPC64 && reload_completed"
6368 [(set (match_dup 0)
6369 (rotate:DI (match_dup 1) (match_dup 2)))
6370 (set (match_dup 3)
6371 (compare:CC (match_dup 0)
6372 (const_int 0)))]
6373 "")
6374
6375 (define_insn "*rotldi3_internal4"
6376 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6377 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6378 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
6379 (match_operand:DI 3 "mask64_operand" "S")))]
6380 "TARGET_POWERPC64"
6381 "rld%I2c%B3 %0,%1,%H2,%S3")
6382
6383 (define_insn "*rotldi3_internal5"
6384 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6385 (compare:CC (and:DI
6386 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6387 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6388 (match_operand:DI 3 "mask64_operand" "S,S"))
6389 (const_int 0)))
6390 (clobber (match_scratch:DI 4 "=r,r"))]
6391 "TARGET_POWERPC64"
6392 "@
6393 rld%I2c%B3. %4,%1,%H2,%S3
6394 #"
6395 [(set_attr "type" "delayed_compare")
6396 (set_attr "length" "4,8")])
6397
6398 (define_split
6399 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6400 (compare:CC (and:DI
6401 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6402 (match_operand:DI 2 "reg_or_cint_operand" ""))
6403 (match_operand:DI 3 "mask64_operand" ""))
6404 (const_int 0)))
6405 (clobber (match_scratch:DI 4 ""))]
6406 "TARGET_POWERPC64 && reload_completed"
6407 [(set (match_dup 4)
6408 (and:DI (rotate:DI (match_dup 1)
6409 (match_dup 2))
6410 (match_dup 3)))
6411 (set (match_dup 0)
6412 (compare:CC (match_dup 4)
6413 (const_int 0)))]
6414 "")
6415
6416 (define_insn "*rotldi3_internal6"
6417 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6418 (compare:CC (and:DI
6419 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6420 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6421 (match_operand:DI 3 "mask64_operand" "S,S"))
6422 (const_int 0)))
6423 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6424 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6425 "TARGET_POWERPC64"
6426 "@
6427 rld%I2c%B3. %0,%1,%H2,%S3
6428 #"
6429 [(set_attr "type" "delayed_compare")
6430 (set_attr "length" "4,8")])
6431
6432 (define_split
6433 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6434 (compare:CC (and:DI
6435 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6436 (match_operand:DI 2 "reg_or_cint_operand" ""))
6437 (match_operand:DI 3 "mask64_operand" ""))
6438 (const_int 0)))
6439 (set (match_operand:DI 0 "gpc_reg_operand" "")
6440 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6441 "TARGET_POWERPC64 && reload_completed"
6442 [(set (match_dup 0)
6443 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6444 (set (match_dup 4)
6445 (compare:CC (match_dup 0)
6446 (const_int 0)))]
6447 "")
6448
6449 (define_insn "*rotldi3_internal7"
6450 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6451 (zero_extend:DI
6452 (subreg:QI
6453 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6454 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6455 "TARGET_POWERPC64"
6456 "rld%I2cl %0,%1,%H2,56")
6457
6458 (define_insn "*rotldi3_internal8"
6459 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6460 (compare:CC (zero_extend:DI
6461 (subreg:QI
6462 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6463 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6464 (const_int 0)))
6465 (clobber (match_scratch:DI 3 "=r,r"))]
6466 "TARGET_POWERPC64"
6467 "@
6468 rld%I2cl. %3,%1,%H2,56
6469 #"
6470 [(set_attr "type" "delayed_compare")
6471 (set_attr "length" "4,8")])
6472
6473 (define_split
6474 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6475 (compare:CC (zero_extend:DI
6476 (subreg:QI
6477 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6478 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6479 (const_int 0)))
6480 (clobber (match_scratch:DI 3 ""))]
6481 "TARGET_POWERPC64 && reload_completed"
6482 [(set (match_dup 3)
6483 (zero_extend:DI (subreg:QI
6484 (rotate:DI (match_dup 1)
6485 (match_dup 2)) 0)))
6486 (set (match_dup 0)
6487 (compare:CC (match_dup 3)
6488 (const_int 0)))]
6489 "")
6490
6491 (define_insn "*rotldi3_internal9"
6492 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6493 (compare:CC (zero_extend:DI
6494 (subreg:QI
6495 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6496 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6497 (const_int 0)))
6498 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6499 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6500 "TARGET_POWERPC64"
6501 "@
6502 rld%I2cl. %0,%1,%H2,56
6503 #"
6504 [(set_attr "type" "delayed_compare")
6505 (set_attr "length" "4,8")])
6506
6507 (define_split
6508 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6509 (compare:CC (zero_extend:DI
6510 (subreg:QI
6511 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6512 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6513 (const_int 0)))
6514 (set (match_operand:DI 0 "gpc_reg_operand" "")
6515 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6516 "TARGET_POWERPC64 && reload_completed"
6517 [(set (match_dup 0)
6518 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6519 (set (match_dup 3)
6520 (compare:CC (match_dup 0)
6521 (const_int 0)))]
6522 "")
6523
6524 (define_insn "*rotldi3_internal10"
6525 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6526 (zero_extend:DI
6527 (subreg:HI
6528 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6529 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6530 "TARGET_POWERPC64"
6531 "rld%I2cl %0,%1,%H2,48")
6532
6533 (define_insn "*rotldi3_internal11"
6534 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6535 (compare:CC (zero_extend:DI
6536 (subreg:HI
6537 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6538 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6539 (const_int 0)))
6540 (clobber (match_scratch:DI 3 "=r,r"))]
6541 "TARGET_POWERPC64"
6542 "@
6543 rld%I2cl. %3,%1,%H2,48
6544 #"
6545 [(set_attr "type" "delayed_compare")
6546 (set_attr "length" "4,8")])
6547
6548 (define_split
6549 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6550 (compare:CC (zero_extend:DI
6551 (subreg:HI
6552 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6553 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6554 (const_int 0)))
6555 (clobber (match_scratch:DI 3 ""))]
6556 "TARGET_POWERPC64 && reload_completed"
6557 [(set (match_dup 3)
6558 (zero_extend:DI (subreg:HI
6559 (rotate:DI (match_dup 1)
6560 (match_dup 2)) 0)))
6561 (set (match_dup 0)
6562 (compare:CC (match_dup 3)
6563 (const_int 0)))]
6564 "")
6565
6566 (define_insn "*rotldi3_internal12"
6567 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6568 (compare:CC (zero_extend:DI
6569 (subreg:HI
6570 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6571 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6572 (const_int 0)))
6573 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6574 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6575 "TARGET_POWERPC64"
6576 "@
6577 rld%I2cl. %0,%1,%H2,48
6578 #"
6579 [(set_attr "type" "delayed_compare")
6580 (set_attr "length" "4,8")])
6581
6582 (define_split
6583 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6584 (compare:CC (zero_extend:DI
6585 (subreg:HI
6586 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6587 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6588 (const_int 0)))
6589 (set (match_operand:DI 0 "gpc_reg_operand" "")
6590 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6591 "TARGET_POWERPC64 && reload_completed"
6592 [(set (match_dup 0)
6593 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6594 (set (match_dup 3)
6595 (compare:CC (match_dup 0)
6596 (const_int 0)))]
6597 "")
6598
6599 (define_insn "*rotldi3_internal13"
6600 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6601 (zero_extend:DI
6602 (subreg:SI
6603 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6604 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6605 "TARGET_POWERPC64"
6606 "rld%I2cl %0,%1,%H2,32")
6607
6608 (define_insn "*rotldi3_internal14"
6609 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6610 (compare:CC (zero_extend:DI
6611 (subreg:SI
6612 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6613 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6614 (const_int 0)))
6615 (clobber (match_scratch:DI 3 "=r,r"))]
6616 "TARGET_POWERPC64"
6617 "@
6618 rld%I2cl. %3,%1,%H2,32
6619 #"
6620 [(set_attr "type" "delayed_compare")
6621 (set_attr "length" "4,8")])
6622
6623 (define_split
6624 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6625 (compare:CC (zero_extend:DI
6626 (subreg:SI
6627 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6628 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6629 (const_int 0)))
6630 (clobber (match_scratch:DI 3 ""))]
6631 "TARGET_POWERPC64 && reload_completed"
6632 [(set (match_dup 3)
6633 (zero_extend:DI (subreg:SI
6634 (rotate:DI (match_dup 1)
6635 (match_dup 2)) 0)))
6636 (set (match_dup 0)
6637 (compare:CC (match_dup 3)
6638 (const_int 0)))]
6639 "")
6640
6641 (define_insn "*rotldi3_internal15"
6642 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6643 (compare:CC (zero_extend:DI
6644 (subreg:SI
6645 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6646 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6647 (const_int 0)))
6648 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6649 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6650 "TARGET_POWERPC64"
6651 "@
6652 rld%I2cl. %0,%1,%H2,32
6653 #"
6654 [(set_attr "type" "delayed_compare")
6655 (set_attr "length" "4,8")])
6656
6657 (define_split
6658 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6659 (compare:CC (zero_extend:DI
6660 (subreg:SI
6661 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6662 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6663 (const_int 0)))
6664 (set (match_operand:DI 0 "gpc_reg_operand" "")
6665 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6666 "TARGET_POWERPC64 && reload_completed"
6667 [(set (match_dup 0)
6668 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6669 (set (match_dup 3)
6670 (compare:CC (match_dup 0)
6671 (const_int 0)))]
6672 "")
6673
6674 (define_expand "ashldi3"
6675 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6676 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6677 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6678 "TARGET_POWERPC64 || TARGET_POWER"
6679 "
6680 {
6681 if (TARGET_POWERPC64)
6682 ;
6683 else if (TARGET_POWER)
6684 {
6685 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
6686 DONE;
6687 }
6688 else
6689 FAIL;
6690 }")
6691
6692 (define_insn "*ashldi3_internal1"
6693 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6694 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6695 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6696 "TARGET_POWERPC64"
6697 "sld%I2 %0,%1,%H2"
6698 [(set_attr "length" "8")])
6699
6700 (define_insn "*ashldi3_internal2"
6701 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6702 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6703 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6704 (const_int 0)))
6705 (clobber (match_scratch:DI 3 "=r,r"))]
6706 "TARGET_POWERPC64"
6707 "@
6708 sld%I2. %3,%1,%H2
6709 #"
6710 [(set_attr "type" "delayed_compare")
6711 (set_attr "length" "4,8")])
6712
6713 (define_split
6714 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6715 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6716 (match_operand:SI 2 "reg_or_cint_operand" ""))
6717 (const_int 0)))
6718 (clobber (match_scratch:DI 3 ""))]
6719 "TARGET_POWERPC64 && reload_completed"
6720 [(set (match_dup 3)
6721 (ashift:DI (match_dup 1) (match_dup 2)))
6722 (set (match_dup 0)
6723 (compare:CC (match_dup 3)
6724 (const_int 0)))]
6725 "")
6726
6727 (define_insn "*ashldi3_internal3"
6728 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6729 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6730 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6731 (const_int 0)))
6732 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6733 (ashift:DI (match_dup 1) (match_dup 2)))]
6734 "TARGET_POWERPC64"
6735 "@
6736 sld%I2. %0,%1,%H2
6737 #"
6738 [(set_attr "type" "delayed_compare")
6739 (set_attr "length" "4,8")])
6740
6741 (define_split
6742 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6743 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6744 (match_operand:SI 2 "reg_or_cint_operand" ""))
6745 (const_int 0)))
6746 (set (match_operand:DI 0 "gpc_reg_operand" "")
6747 (ashift:DI (match_dup 1) (match_dup 2)))]
6748 "TARGET_POWERPC64 && reload_completed"
6749 [(set (match_dup 0)
6750 (ashift:DI (match_dup 1) (match_dup 2)))
6751 (set (match_dup 3)
6752 (compare:CC (match_dup 0)
6753 (const_int 0)))]
6754 "")
6755
6756 (define_insn "*ashldi3_internal4"
6757 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6758 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6759 (match_operand:SI 2 "const_int_operand" "i"))
6760 (match_operand:DI 3 "const_int_operand" "n")))]
6761 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6762 "rldic %0,%1,%H2,%W3")
6763
6764 (define_insn "ashldi3_internal5"
6765 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6766 (compare:CC
6767 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6768 (match_operand:SI 2 "const_int_operand" "i,i"))
6769 (match_operand:DI 3 "const_int_operand" "n,n"))
6770 (const_int 0)))
6771 (clobber (match_scratch:DI 4 "=r,r"))]
6772 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6773 "@
6774 rldic. %4,%1,%H2,%W3
6775 #"
6776 [(set_attr "type" "delayed_compare")
6777 (set_attr "length" "4,8")])
6778
6779 (define_split
6780 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6781 (compare:CC
6782 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6783 (match_operand:SI 2 "const_int_operand" ""))
6784 (match_operand:DI 3 "const_int_operand" ""))
6785 (const_int 0)))
6786 (clobber (match_scratch:DI 4 ""))]
6787 "TARGET_POWERPC64 && reload_completed
6788 && includes_rldic_lshift_p (operands[2], operands[3])"
6789 [(set (match_dup 4)
6790 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6791 (match_dup 3)))
6792 (set (match_dup 0)
6793 (compare:CC (match_dup 4)
6794 (const_int 0)))]
6795 "")
6796
6797 (define_insn "*ashldi3_internal6"
6798 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6799 (compare:CC
6800 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6801 (match_operand:SI 2 "const_int_operand" "i,i"))
6802 (match_operand:DI 3 "const_int_operand" "n,n"))
6803 (const_int 0)))
6804 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6805 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6806 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6807 "@
6808 rldic. %0,%1,%H2,%W3
6809 #"
6810 [(set_attr "type" "delayed_compare")
6811 (set_attr "length" "4,8")])
6812
6813 (define_split
6814 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6815 (compare:CC
6816 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6817 (match_operand:SI 2 "const_int_operand" ""))
6818 (match_operand:DI 3 "const_int_operand" ""))
6819 (const_int 0)))
6820 (set (match_operand:DI 0 "gpc_reg_operand" "")
6821 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6822 "TARGET_POWERPC64 && reload_completed
6823 && includes_rldic_lshift_p (operands[2], operands[3])"
6824 [(set (match_dup 0)
6825 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6826 (match_dup 3)))
6827 (set (match_dup 4)
6828 (compare:CC (match_dup 0)
6829 (const_int 0)))]
6830 "")
6831
6832 (define_insn "*ashldi3_internal7"
6833 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6834 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6835 (match_operand:SI 2 "const_int_operand" "i"))
6836 (match_operand:DI 3 "mask64_operand" "S")))]
6837 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
6838 "rldicr %0,%1,%H2,%S3")
6839
6840 (define_insn "ashldi3_internal8"
6841 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6842 (compare:CC
6843 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6844 (match_operand:SI 2 "const_int_operand" "i,i"))
6845 (match_operand:DI 3 "mask64_operand" "S,S"))
6846 (const_int 0)))
6847 (clobber (match_scratch:DI 4 "=r,r"))]
6848 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
6849 "@
6850 rldicr. %4,%1,%H2,%S3
6851 #"
6852 [(set_attr "type" "delayed_compare")
6853 (set_attr "length" "4,8")])
6854
6855 (define_split
6856 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6857 (compare:CC
6858 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6859 (match_operand:SI 2 "const_int_operand" ""))
6860 (match_operand:DI 3 "mask64_operand" ""))
6861 (const_int 0)))
6862 (clobber (match_scratch:DI 4 ""))]
6863 "TARGET_POWERPC64 && reload_completed
6864 && includes_rldicr_lshift_p (operands[2], operands[3])"
6865 [(set (match_dup 4)
6866 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6867 (match_dup 3)))
6868 (set (match_dup 0)
6869 (compare:CC (match_dup 4)
6870 (const_int 0)))]
6871 "")
6872
6873 (define_insn "*ashldi3_internal9"
6874 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6875 (compare:CC
6876 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6877 (match_operand:SI 2 "const_int_operand" "i,i"))
6878 (match_operand:DI 3 "mask64_operand" "S,S"))
6879 (const_int 0)))
6880 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6881 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6882 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
6883 "@
6884 rldicr. %0,%1,%H2,%S3
6885 #"
6886 [(set_attr "type" "delayed_compare")
6887 (set_attr "length" "4,8")])
6888
6889 (define_split
6890 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6891 (compare:CC
6892 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6893 (match_operand:SI 2 "const_int_operand" ""))
6894 (match_operand:DI 3 "mask64_operand" ""))
6895 (const_int 0)))
6896 (set (match_operand:DI 0 "gpc_reg_operand" "")
6897 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6898 "TARGET_POWERPC64 && reload_completed
6899 && includes_rldicr_lshift_p (operands[2], operands[3])"
6900 [(set (match_dup 0)
6901 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6902 (match_dup 3)))
6903 (set (match_dup 4)
6904 (compare:CC (match_dup 0)
6905 (const_int 0)))]
6906 "")
6907
6908 (define_expand "lshrdi3"
6909 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6910 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6911 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6912 "TARGET_POWERPC64 || TARGET_POWER"
6913 "
6914 {
6915 if (TARGET_POWERPC64)
6916 ;
6917 else if (TARGET_POWER)
6918 {
6919 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
6920 DONE;
6921 }
6922 else
6923 FAIL;
6924 }")
6925
6926 (define_insn "*lshrdi3_internal1"
6927 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6928 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6929 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6930 "TARGET_POWERPC64"
6931 "srd%I2 %0,%1,%H2")
6932
6933 (define_insn "*lshrdi3_internal2"
6934 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6935 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6936 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6937 (const_int 0)))
6938 (clobber (match_scratch:DI 3 "=r,r"))]
6939 "TARGET_POWERPC64"
6940 "@
6941 srd%I2. %3,%1,%H2
6942 #"
6943 [(set_attr "type" "delayed_compare")
6944 (set_attr "length" "4,8")])
6945
6946 (define_split
6947 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6948 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6949 (match_operand:SI 2 "reg_or_cint_operand" ""))
6950 (const_int 0)))
6951 (clobber (match_scratch:DI 3 ""))]
6952 "TARGET_POWERPC64 && reload_completed"
6953 [(set (match_dup 3)
6954 (lshiftrt:DI (match_dup 1) (match_dup 2)))
6955 (set (match_dup 0)
6956 (compare:CC (match_dup 3)
6957 (const_int 0)))]
6958 "")
6959
6960 (define_insn "*lshrdi3_internal3"
6961 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6962 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6963 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6964 (const_int 0)))
6965 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6966 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
6967 "TARGET_POWERPC64"
6968 "@
6969 srd%I2. %0,%1,%H2
6970 #"
6971 [(set_attr "type" "delayed_compare")
6972 (set_attr "length" "4,8")])
6973
6974 (define_split
6975 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6976 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6977 (match_operand:SI 2 "reg_or_cint_operand" ""))
6978 (const_int 0)))
6979 (set (match_operand:DI 0 "gpc_reg_operand" "")
6980 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
6981 "TARGET_POWERPC64 && reload_completed"
6982 [(set (match_dup 0)
6983 (lshiftrt:DI (match_dup 1) (match_dup 2)))
6984 (set (match_dup 3)
6985 (compare:CC (match_dup 0)
6986 (const_int 0)))]
6987 "")
6988
6989 (define_expand "ashrdi3"
6990 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6991 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6992 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6993 "TARGET_POWERPC64 || TARGET_POWER"
6994 "
6995 {
6996 if (TARGET_POWERPC64)
6997 ;
6998 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
6999 {
7000 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
7001 DONE;
7002 }
7003 else
7004 FAIL;
7005 }")
7006
7007 (define_insn "*ashrdi3_internal1"
7008 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7009 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7010 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
7011 "TARGET_POWERPC64"
7012 "srad%I2 %0,%1,%H2")
7013
7014 (define_insn "*ashrdi3_internal2"
7015 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7016 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7017 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7018 (const_int 0)))
7019 (clobber (match_scratch:DI 3 "=r,r"))]
7020 "TARGET_POWERPC64"
7021 "@
7022 srad%I2. %3,%1,%H2
7023 #"
7024 [(set_attr "type" "delayed_compare")
7025 (set_attr "length" "4,8")])
7026
7027 (define_split
7028 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7029 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7030 (match_operand:SI 2 "reg_or_cint_operand" ""))
7031 (const_int 0)))
7032 (clobber (match_scratch:DI 3 ""))]
7033 "TARGET_POWERPC64 && reload_completed"
7034 [(set (match_dup 3)
7035 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7036 (set (match_dup 0)
7037 (compare:CC (match_dup 3)
7038 (const_int 0)))]
7039 "")
7040
7041 (define_insn "*ashrdi3_internal3"
7042 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7043 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7044 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7045 (const_int 0)))
7046 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7047 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7048 "TARGET_POWERPC64"
7049 "@
7050 srad%I2. %0,%1,%H2
7051 #"
7052 [(set_attr "type" "delayed_compare")
7053 (set_attr "length" "4,8")])
7054
7055 (define_split
7056 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7057 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7058 (match_operand:SI 2 "reg_or_cint_operand" ""))
7059 (const_int 0)))
7060 (set (match_operand:DI 0 "gpc_reg_operand" "")
7061 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7062 "TARGET_POWERPC64 && reload_completed"
7063 [(set (match_dup 0)
7064 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7065 (set (match_dup 3)
7066 (compare:CC (match_dup 0)
7067 (const_int 0)))]
7068 "")
7069
7070 (define_insn "anddi3"
7071 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7072 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
7073 (match_operand:DI 2 "and64_operand" "?r,S,K,J")))
7074 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
7075 "TARGET_POWERPC64"
7076 "@
7077 and %0,%1,%2
7078 rldic%B2 %0,%1,0,%S2
7079 andi. %0,%1,%b2
7080 andis. %0,%1,%u2")
7081
7082 (define_insn "*anddi3_internal2"
7083 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,?y,??y,??y")
7084 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,")
7085 (match_operand:DI 2 "and64_operand" "r,S,K,J,r,S,K,J"))
7086 (const_int 0)))
7087 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r"))
7088 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,x,x"))]
7089 "TARGET_POWERPC64"
7090 "@
7091 and. %3,%1,%2
7092 rldic%B2. %3,%1,0,%S2
7093 andi. %3,%1,%b2
7094 andis. %3,%1,%u2
7095 #
7096 #
7097 #
7098 #"
7099 [(set_attr "type" "compare,delayed_compare,compare,compare,compare,delayed_compare,compare,compare")
7100 (set_attr "length" "4,4,4,4,8,8,8,8")])
7101
7102 (define_split
7103 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7104 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7105 (match_operand:DI 2 "and64_operand" ""))
7106 (const_int 0)))
7107 (clobber (match_scratch:DI 3 ""))
7108 (clobber (match_scratch:CC 4 ""))]
7109 "TARGET_POWERPC64 && reload_completed"
7110 [(parallel [(set (match_dup 3)
7111 (and:DI (match_dup 1)
7112 (match_dup 2)))
7113 (clobber (match_dup 4))])
7114 (set (match_dup 0)
7115 (compare:CC (match_dup 3)
7116 (const_int 0)))]
7117 "")
7118
7119 (define_insn "*anddi3_internal3"
7120 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,?y,??y,??y")
7121 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
7122 (match_operand:DI 2 "and64_operand" "r,S,K,J,r,S,K,J"))
7123 (const_int 0)))
7124 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
7125 (and:DI (match_dup 1) (match_dup 2)))
7126 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,x,x"))]
7127 "TARGET_POWERPC64"
7128 "@
7129 and. %0,%1,%2
7130 rldic%B2. %0,%1,0,%S2
7131 andi. %0,%1,%b2
7132 andis. %0,%1,%u2
7133 #
7134 #
7135 #
7136 #"
7137 [(set_attr "type" "compare,delayed_compare,compare,compare,compare,delayed_compare,compare,compare")
7138 (set_attr "length" "4,4,4,4,8,8,8,8")])
7139
7140 (define_split
7141 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7142 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7143 (match_operand:DI 2 "and64_operand" ""))
7144 (const_int 0)))
7145 (set (match_operand:DI 0 "gpc_reg_operand" "")
7146 (and:DI (match_dup 1) (match_dup 2)))
7147 (clobber (match_scratch:CC 4 ""))]
7148 "TARGET_POWERPC64 && reload_completed"
7149 [(parallel [(set (match_dup 0)
7150 (and:DI (match_dup 1) (match_dup 2)))
7151 (clobber (match_dup 4))])
7152 (set (match_dup 3)
7153 (compare:CC (match_dup 0)
7154 (const_int 0)))]
7155 "")
7156
7157 (define_expand "iordi3"
7158 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7159 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7160 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7161 "TARGET_POWERPC64"
7162 "
7163 {
7164 if (non_logical_cint_operand (operands[2], DImode))
7165 {
7166 HOST_WIDE_INT value;
7167 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7168 ? operands[0] : gen_reg_rtx (DImode));
7169
7170 if (GET_CODE (operands[2]) == CONST_INT)
7171 {
7172 value = INTVAL (operands[2]);
7173 emit_insn (gen_iordi3 (tmp, operands[1],
7174 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7175 }
7176 else
7177 {
7178 value = CONST_DOUBLE_LOW (operands[2]);
7179 emit_insn (gen_iordi3 (tmp, operands[1],
7180 immed_double_const (value
7181 & (~ (HOST_WIDE_INT) 0xffff),
7182 0, DImode)));
7183 }
7184
7185 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7186 DONE;
7187 }
7188 }")
7189
7190 (define_expand "xordi3"
7191 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7192 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7193 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7194 "TARGET_POWERPC64"
7195 "
7196 {
7197 if (non_logical_cint_operand (operands[2], DImode))
7198 {
7199 HOST_WIDE_INT value;
7200 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7201 ? operands[0] : gen_reg_rtx (DImode));
7202
7203 if (GET_CODE (operands[2]) == CONST_INT)
7204 {
7205 value = INTVAL (operands[2]);
7206 emit_insn (gen_xordi3 (tmp, operands[1],
7207 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7208 }
7209 else
7210 {
7211 value = CONST_DOUBLE_LOW (operands[2]);
7212 emit_insn (gen_xordi3 (tmp, operands[1],
7213 immed_double_const (value
7214 & (~ (HOST_WIDE_INT) 0xffff),
7215 0, DImode)));
7216 }
7217
7218 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7219 DONE;
7220 }
7221 }")
7222
7223 (define_insn "*booldi3_internal1"
7224 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7225 (match_operator:DI 3 "boolean_or_operator"
7226 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7227 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7228 "TARGET_POWERPC64"
7229 "@
7230 %q3 %0,%1,%2
7231 %q3i %0,%1,%b2
7232 %q3is %0,%1,%u2")
7233
7234 (define_insn "*booldi3_internal2"
7235 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7236 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7237 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7238 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7239 (const_int 0)))
7240 (clobber (match_scratch:DI 3 "=r,r"))]
7241 "TARGET_POWERPC64"
7242 "@
7243 %q4. %3,%1,%2
7244 #"
7245 [(set_attr "type" "compare")
7246 (set_attr "length" "4,8")])
7247
7248 (define_split
7249 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7250 (compare:CC (match_operator:DI 4 "boolean_operator"
7251 [(match_operand:DI 1 "gpc_reg_operand" "")
7252 (match_operand:DI 2 "gpc_reg_operand" "")])
7253 (const_int 0)))
7254 (clobber (match_scratch:DI 3 ""))]
7255 "TARGET_POWERPC64 && reload_completed"
7256 [(set (match_dup 3) (match_dup 4))
7257 (set (match_dup 0)
7258 (compare:CC (match_dup 3)
7259 (const_int 0)))]
7260 "")
7261
7262 (define_insn "*booldi3_internal3"
7263 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7264 (compare:CC (match_operator:DI 4 "boolean_operator"
7265 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7266 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7267 (const_int 0)))
7268 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7269 (match_dup 4))]
7270 "TARGET_POWERPC64"
7271 "@
7272 %q4. %0,%1,%2
7273 #"
7274 [(set_attr "type" "compare")
7275 (set_attr "length" "4,8")])
7276
7277 (define_split
7278 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7279 (compare:CC (match_operator:DI 4 "boolean_operator"
7280 [(match_operand:DI 1 "gpc_reg_operand" "")
7281 (match_operand:DI 2 "gpc_reg_operand" "")])
7282 (const_int 0)))
7283 (set (match_operand:DI 0 "gpc_reg_operand" "")
7284 (match_dup 4))]
7285 "TARGET_POWERPC64 && reload_completed"
7286 [(set (match_dup 0) (match_dup 4))
7287 (set (match_dup 3)
7288 (compare:CC (match_dup 0)
7289 (const_int 0)))]
7290 "")
7291
7292 ;; Split an logical operation that we can't do in one insn into two insns,
7293 ;; each of which does one 16-bit part. This is used by combine.
7294
7295 (define_split
7296 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7297 (match_operator:DI 3 "boolean_or_operator"
7298 [(match_operand:DI 1 "gpc_reg_operand" "")
7299 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7300 "TARGET_POWERPC64"
7301 [(set (match_dup 0) (match_dup 4))
7302 (set (match_dup 0) (match_dup 5))]
7303 "
7304 {
7305 rtx i3,i4;
7306
7307 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7308 {
7309 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7310 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7311 0, DImode);
7312 i4 = GEN_INT (value & 0xffff);
7313 }
7314 else
7315 {
7316 i3 = GEN_INT (INTVAL (operands[2])
7317 & (~ (HOST_WIDE_INT) 0xffff));
7318 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7319 }
7320 operands[4] = gen_rtx (GET_CODE (operands[3]), DImode,
7321 operands[1], i3);
7322 operands[5] = gen_rtx (GET_CODE (operands[3]), DImode,
7323 operands[0], i4);
7324 }")
7325
7326 (define_insn "*boolcdi3_internal1"
7327 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7328 (match_operator:DI 3 "boolean_operator"
7329 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7330 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7331 "TARGET_POWERPC64"
7332 "%q3 %0,%2,%1")
7333
7334 (define_insn "*boolcdi3_internal2"
7335 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7336 (compare:CC (match_operator:DI 4 "boolean_operator"
7337 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7338 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7339 (const_int 0)))
7340 (clobber (match_scratch:DI 3 "=r,r"))]
7341 "TARGET_POWERPC64"
7342 "@
7343 %q4. %3,%2,%1
7344 #"
7345 [(set_attr "type" "compare")
7346 (set_attr "length" "4,8")])
7347
7348 (define_split
7349 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7350 (compare:CC (match_operator:DI 4 "boolean_operator"
7351 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7352 (match_operand:DI 2 "gpc_reg_operand" "")])
7353 (const_int 0)))
7354 (clobber (match_scratch:DI 3 ""))]
7355 "TARGET_POWERPC64 && reload_completed"
7356 [(set (match_dup 3) (match_dup 4))
7357 (set (match_dup 0)
7358 (compare:CC (match_dup 3)
7359 (const_int 0)))]
7360 "")
7361
7362 (define_insn "*boolcdi3_internal3"
7363 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7364 (compare:CC (match_operator:DI 4 "boolean_operator"
7365 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7366 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7367 (const_int 0)))
7368 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7369 (match_dup 4))]
7370 "TARGET_POWERPC64"
7371 "@
7372 %q4. %0,%2,%1
7373 #"
7374 [(set_attr "type" "compare")
7375 (set_attr "length" "4,8")])
7376
7377 (define_split
7378 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7379 (compare:CC (match_operator:DI 4 "boolean_operator"
7380 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7381 (match_operand:DI 2 "gpc_reg_operand" "")])
7382 (const_int 0)))
7383 (set (match_operand:DI 0 "gpc_reg_operand" "")
7384 (match_dup 4))]
7385 "TARGET_POWERPC64 && reload_completed"
7386 [(set (match_dup 0) (match_dup 4))
7387 (set (match_dup 3)
7388 (compare:CC (match_dup 0)
7389 (const_int 0)))]
7390 "")
7391
7392 (define_insn "*boolccdi3_internal1"
7393 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7394 (match_operator:DI 3 "boolean_operator"
7395 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7396 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7397 "TARGET_POWERPC64"
7398 "%q3 %0,%1,%2")
7399
7400 (define_insn "*boolccdi3_internal2"
7401 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7402 (compare:CC (match_operator:DI 4 "boolean_operator"
7403 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7404 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7405 (const_int 0)))
7406 (clobber (match_scratch:DI 3 "=r,r"))]
7407 "TARGET_POWERPC64"
7408 "@
7409 %q4. %3,%1,%2
7410 #"
7411 [(set_attr "type" "compare")
7412 (set_attr "length" "4,8")])
7413
7414 (define_split
7415 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7416 (compare:CC (match_operator:DI 4 "boolean_operator"
7417 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7418 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7419 (const_int 0)))
7420 (clobber (match_scratch:DI 3 ""))]
7421 "TARGET_POWERPC64 && reload_completed"
7422 [(set (match_dup 3) (match_dup 4))
7423 (set (match_dup 0)
7424 (compare:CC (match_dup 3)
7425 (const_int 0)))]
7426 "")
7427
7428 (define_insn "*boolccdi3_internal3"
7429 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7430 (compare:CC (match_operator:DI 4 "boolean_operator"
7431 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7432 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7433 (const_int 0)))
7434 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7435 (match_dup 4))]
7436 "TARGET_POWERPC64"
7437 "@
7438 %q4. %0,%1,%2
7439 #"
7440 [(set_attr "type" "compare")
7441 (set_attr "length" "4,8")])
7442
7443 (define_split
7444 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7445 (compare:CC (match_operator:DI 4 "boolean_operator"
7446 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7447 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7448 (const_int 0)))
7449 (set (match_operand:DI 0 "gpc_reg_operand" "")
7450 (match_dup 4))]
7451 "TARGET_POWERPC64 && reload_completed"
7452 [(set (match_dup 0) (match_dup 4))
7453 (set (match_dup 3)
7454 (compare:CC (match_dup 0)
7455 (const_int 0)))]
7456 "")
7457 \f
7458 ;; Now define ways of moving data around.
7459
7460 ;; Elf specific ways of loading addresses for non-PIC code.
7461 ;; The output of this could be r0, but we make a very strong
7462 ;; preference for a base register because it will usually
7463 ;; be needed there.
7464 (define_insn "elf_high"
7465 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
7466 (high:SI (match_operand 1 "" "")))]
7467 "TARGET_ELF && ! TARGET_64BIT"
7468 "{liu|lis} %0,%1@ha")
7469
7470 (define_insn "elf_low"
7471 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7472 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
7473 (match_operand 2 "" "")))]
7474 "TARGET_ELF && ! TARGET_64BIT"
7475 "@
7476 {cal|la} %0,%2@l(%1)
7477 {ai|addic} %0,%1,%K2")
7478
7479 ;; Mach-O PIC trickery.
7480 (define_insn "macho_high"
7481 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
7482 (high:SI (match_operand 1 "" "")))]
7483 "TARGET_MACHO && ! TARGET_64BIT"
7484 "{liu|lis} %0,ha16(%1)")
7485
7486 (define_insn "macho_low"
7487 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7488 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
7489 (match_operand 2 "" "")))]
7490 "TARGET_MACHO && ! TARGET_64BIT"
7491 "@
7492 {cal %0,%a2@l(%1)|la %0,lo16(%2)(%1)}
7493 {cal %0,%a2@l(%1)|addic %0,%1,lo16(%2)}")
7494
7495 ;; Set up a register with a value from the GOT table
7496
7497 (define_expand "movsi_got"
7498 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7499 (unspec:SI [(match_operand:SI 1 "got_operand" "")
7500 (match_dup 2)] 8))]
7501 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7502 "
7503 {
7504 if (GET_CODE (operands[1]) == CONST)
7505 {
7506 rtx offset = const0_rtx;
7507 HOST_WIDE_INT value;
7508
7509 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
7510 value = INTVAL (offset);
7511 if (value != 0)
7512 {
7513 rtx tmp = (no_new_pseudos ? operands[0] : gen_reg_rtx (Pmode));
7514 emit_insn (gen_movsi_got (tmp, operands[1]));
7515 emit_insn (gen_addsi3 (operands[0], tmp, offset));
7516 DONE;
7517 }
7518 }
7519
7520 operands[2] = rs6000_got_register (operands[1]);
7521 }")
7522
7523 (define_insn "*movsi_got_internal"
7524 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7525 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7526 (match_operand:SI 2 "gpc_reg_operand" "b")] 8))]
7527 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7528 "{l|lwz} %0,%a1@got(%2)"
7529 [(set_attr "type" "load")])
7530
7531 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
7532 ;; didn't get allocated to a hard register.
7533 (define_split
7534 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7535 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7536 (match_operand:SI 2 "memory_operand" "")] 8))]
7537 "DEFAULT_ABI == ABI_V4
7538 && flag_pic == 1
7539 && (reload_in_progress || reload_completed)"
7540 [(set (match_dup 0) (match_dup 2))
7541 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)] 8))]
7542 "")
7543
7544 ;; For SI, we special-case integers that can't be loaded in one insn. We
7545 ;; do the load 16-bits at a time. We could do this by loading from memory,
7546 ;; and this is even supposed to be faster, but it is simpler not to get
7547 ;; integers in the TOC.
7548 (define_expand "movsi"
7549 [(set (match_operand:SI 0 "general_operand" "")
7550 (match_operand:SI 1 "any_operand" ""))]
7551 ""
7552 "{ rs6000_emit_move (operands[0], operands[1], SImode); DONE; }")
7553
7554 (define_insn "movsi_low"
7555 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7556 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7557 (match_operand 2 "" ""))))]
7558 "TARGET_MACHO && ! TARGET_64BIT"
7559 "{l|lwz} %0,lo16(%2)(%1)"
7560 [(set_attr "type" "load")
7561 (set_attr "length" "4")])
7562
7563 (define_insn "movsi_low_st"
7564 [(set (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7565 (match_operand 2 "" "")))
7566 (match_operand:SI 0 "gpc_reg_operand" "r"))]
7567 "TARGET_MACHO && ! TARGET_64BIT"
7568 "{st|stw} %0,lo16(%2)(%1)"
7569 [(set_attr "type" "store")
7570 (set_attr "length" "4")])
7571
7572 (define_insn "movdf_low"
7573 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,!r")
7574 (mem:DF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
7575 (match_operand 2 "" ""))))]
7576 "TARGET_MACHO && TARGET_HARD_FLOAT && ! TARGET_64BIT"
7577 "*
7578 {
7579 switch (which_alternative)
7580 {
7581 case 0:
7582 return \"lfd %0,lo16(%2)(%1)\";
7583 case 1:
7584 {
7585 rtx operands2[4];
7586 operands2[0] = operands[0];
7587 operands2[1] = operands[1];
7588 operands2[2] = operands[2];
7589 operands2[3] = gen_rtx_REG (SImode, RS6000_PIC_OFFSET_TABLE_REGNUM);
7590 output_asm_insn (\"{l|lwz} %0,lo16(%2)(%1)\", operands);
7591 /* We cannot rely on ha16(low half)==ha16(high half), alas,
7592 although in practice it almost always is. */
7593 output_asm_insn (\"{cau|addis} %L0,%3,ha16(%2+4)\", operands2);
7594 return (\"{l|lwz} %L0,lo16(%2+4)(%L0)\");
7595 }
7596 default:
7597 abort();
7598 }
7599 }"
7600 [(set_attr "type" "load")
7601 (set_attr "length" "4,12")])
7602
7603 (define_insn "movdf_low_st"
7604 [(set (mem:DF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7605 (match_operand 2 "" "")))
7606 (match_operand:DF 0 "gpc_reg_operand" "f"))]
7607 "TARGET_MACHO && TARGET_HARD_FLOAT && ! TARGET_64BIT"
7608 "stfd %0,lo16(%2)(%1)"
7609 [(set_attr "type" "store")
7610 (set_attr "length" "4")])
7611
7612 (define_insn "movsf_low"
7613 [(set (match_operand:SF 0 "gpc_reg_operand" "=f,!r")
7614 (mem:SF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
7615 (match_operand 2 "" ""))))]
7616 "TARGET_MACHO && TARGET_HARD_FLOAT && ! TARGET_64BIT"
7617 "@
7618 lfs %0,lo16(%2)(%1)
7619 {l|lwz} %0,lo16(%2)(%1)"
7620 [(set_attr "type" "load")
7621 (set_attr "length" "4")])
7622
7623 (define_insn "movsf_low_st"
7624 [(set (mem:SF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
7625 (match_operand 2 "" "")))
7626 (match_operand:SF 0 "gpc_reg_operand" "f,!r"))]
7627 "TARGET_MACHO && TARGET_HARD_FLOAT && ! TARGET_64BIT"
7628 "@
7629 stfs %0,lo16(%2)(%1)
7630 {st|stw} %0,lo16(%2)(%1)"
7631 [(set_attr "type" "store")
7632 (set_attr "length" "4")])
7633
7634 (define_insn "*movsi_internal1"
7635 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
7636 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
7637 "gpc_reg_operand (operands[0], SImode)
7638 || gpc_reg_operand (operands[1], SImode)"
7639 "@
7640 mr %0,%1
7641 {cal|la} %0,%a1
7642 {l%U1%X1|lwz%U1%X1} %0,%1
7643 {st%U0%X0|stw%U0%X0} %1,%0
7644 {lil|li} %0,%1
7645 {liu|lis} %0,%v1
7646 #
7647 {cal|la} %0,%a1
7648 mf%1 %0
7649 mt%0 %1
7650 mt%0 %1
7651 mt%0 %1
7652 cror 0,0,0"
7653 [(set_attr "type" "*,*,load,store,*,*,*,*,*,*,mtjmpr,*,*")
7654 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
7655
7656 ;; Split a load of a large constant into the appropriate two-insn
7657 ;; sequence.
7658
7659 (define_split
7660 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7661 (match_operand:SI 1 "const_int_operand" ""))]
7662 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
7663 && (INTVAL (operands[1]) & 0xffff) != 0"
7664 [(set (match_dup 0)
7665 (match_dup 2))
7666 (set (match_dup 0)
7667 (ior:SI (match_dup 0)
7668 (match_dup 3)))]
7669 "
7670 {
7671 operands[2] = GEN_INT (INTVAL (operands[1]) & (~ (HOST_WIDE_INT) 0xffff));
7672 operands[3] = GEN_INT (INTVAL (operands[1]) & 0xffff);
7673 }")
7674
7675 (define_insn "*movsi_internal2"
7676 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
7677 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r,r")
7678 (const_int 0)))
7679 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r") (match_dup 1))]
7680 "! TARGET_POWERPC64"
7681 "@
7682 mr. %0,%1
7683 #"
7684 [(set_attr "type" "compare")
7685 (set_attr "length" "4,8")])
7686 \f
7687 (define_split
7688 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
7689 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
7690 (const_int 0)))
7691 (set (match_operand:SI 0 "gpc_reg_operand" "") (match_dup 1))]
7692 "! TARGET_POWERPC64 && reload_completed"
7693 [(set (match_dup 0) (match_dup 1))
7694 (set (match_dup 2)
7695 (compare:CC (match_dup 0)
7696 (const_int 0)))]
7697 "")
7698
7699 (define_expand "movhi"
7700 [(set (match_operand:HI 0 "general_operand" "")
7701 (match_operand:HI 1 "any_operand" ""))]
7702 ""
7703 "{ rs6000_emit_move (operands[0], operands[1], HImode); DONE; }")
7704
7705 (define_insn ""
7706 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7707 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7708 "gpc_reg_operand (operands[0], HImode)
7709 || gpc_reg_operand (operands[1], HImode)"
7710 "@
7711 mr %0,%1
7712 lhz%U1%X1 %0,%1
7713 sth%U0%X0 %1,%0
7714 {lil|li} %0,%w1
7715 mf%1 %0
7716 mt%0 %1
7717 mt%0 %1
7718 cror 0,0,0"
7719 [(set_attr "type" "*,load,store,*,*,*,mtjmpr,*")])
7720
7721 (define_expand "movqi"
7722 [(set (match_operand:QI 0 "general_operand" "")
7723 (match_operand:QI 1 "any_operand" ""))]
7724 ""
7725 "{ rs6000_emit_move (operands[0], operands[1], QImode); DONE; }")
7726
7727 (define_insn ""
7728 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7729 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7730 "gpc_reg_operand (operands[0], QImode)
7731 || gpc_reg_operand (operands[1], QImode)"
7732 "@
7733 mr %0,%1
7734 lbz%U1%X1 %0,%1
7735 stb%U0%X0 %1,%0
7736 {lil|li} %0,%1
7737 mf%1 %0
7738 mt%0 %1
7739 mt%0 %1
7740 cror 0,0,0"
7741 [(set_attr "type" "*,load,store,*,*,*,mtjmpr,*")])
7742 \f
7743 ;; Here is how to move condition codes around. When we store CC data in
7744 ;; an integer register or memory, we store just the high-order 4 bits.
7745 ;; This lets us not shift in the most common case of CR0.
7746 (define_expand "movcc"
7747 [(set (match_operand:CC 0 "nonimmediate_operand" "")
7748 (match_operand:CC 1 "nonimmediate_operand" ""))]
7749 ""
7750 "")
7751
7752 (define_insn "*movcc_internal1"
7753 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,y,r,r,r,r,m")
7754 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,m,r"))]
7755 "register_operand (operands[0], CCmode)
7756 || register_operand (operands[1], CCmode)"
7757 "@
7758 mcrf %0,%1
7759 mtcrf 128,%1
7760 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
7761 mfcr %0
7762 mfcr %0\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
7763 mr %0,%1
7764 {l%U1%X1|lwz%U1%X1} %0,%1
7765 {st%U0%U1|stw%U0%U1} %1,%0"
7766 [(set_attr "type" "*,*,*,compare,*,*,load,store")
7767 (set_attr "length" "*,*,12,*,8,*,*,*")])
7768 \f
7769 ;; For floating-point, we normally deal with the floating-point registers
7770 ;; unless -msoft-float is used. The sole exception is that parameter passing
7771 ;; can produce floating-point values in fixed-point registers. Unless the
7772 ;; value is a simple constant or already in memory, we deal with this by
7773 ;; allocating memory and copying the value explicitly via that memory location.
7774 (define_expand "movsf"
7775 [(set (match_operand:SF 0 "nonimmediate_operand" "")
7776 (match_operand:SF 1 "any_operand" ""))]
7777 ""
7778 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
7779
7780 (define_split
7781 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7782 (match_operand:SF 1 "const_double_operand" ""))]
7783 "reload_completed
7784 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7785 || (GET_CODE (operands[0]) == SUBREG
7786 && GET_CODE (SUBREG_REG (operands[0])) == REG
7787 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7788 [(set (match_dup 2) (match_dup 3))]
7789 "
7790 {
7791 long l;
7792 REAL_VALUE_TYPE rv;
7793
7794 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7795 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
7796
7797 if (! TARGET_POWERPC64)
7798 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
7799 else
7800 operands[2] = gen_lowpart (SImode, operands[0]);
7801
7802 operands[3] = gen_int_mode (l, SImode);
7803 }")
7804
7805 (define_insn "*movsf_hardfloat"
7806 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,!r,!r")
7807 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,G,Fn"))]
7808 "(gpc_reg_operand (operands[0], SFmode)
7809 || gpc_reg_operand (operands[1], SFmode)) && TARGET_HARD_FLOAT"
7810 "@
7811 mr %0,%1
7812 {l%U1%X1|lwz%U1%X1} %0,%1
7813 {st%U0%X0|stw%U0%X0} %1,%0
7814 fmr %0,%1
7815 lfs%U1%X1 %0,%1
7816 stfs%U0%X0 %1,%0
7817 #
7818 #"
7819 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*")
7820 (set_attr "length" "4,4,4,4,4,4,4,8")])
7821
7822 (define_insn "*movsf_softfloat"
7823 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,r")
7824 (match_operand:SF 1 "input_operand" "r,m,r,I,L,R,G,Fn"))]
7825 "(gpc_reg_operand (operands[0], SFmode)
7826 || gpc_reg_operand (operands[1], SFmode)) && TARGET_SOFT_FLOAT"
7827 "@
7828 mr %0,%1
7829 {l%U1%X1|lwz%U1%X1} %0,%1
7830 {st%U0%X0|stw%U0%X0} %1,%0
7831 {lil|li} %0,%1
7832 {liu|lis} %0,%v1
7833 {cal|la} %0,%a1
7834 #
7835 #"
7836 [(set_attr "type" "*,load,store,*,*,*,*,*")
7837 (set_attr "length" "4,4,4,4,4,4,4,8")])
7838
7839 \f
7840 (define_expand "movdf"
7841 [(set (match_operand:DF 0 "nonimmediate_operand" "")
7842 (match_operand:DF 1 "any_operand" ""))]
7843 ""
7844 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
7845
7846 (define_split
7847 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7848 (match_operand:DF 1 "const_int_operand" ""))]
7849 "! TARGET_POWERPC64 && reload_completed
7850 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7851 || (GET_CODE (operands[0]) == SUBREG
7852 && GET_CODE (SUBREG_REG (operands[0])) == REG
7853 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7854 [(set (match_dup 2) (match_dup 4))
7855 (set (match_dup 3) (match_dup 1))]
7856 "
7857 {
7858 int endian = (WORDS_BIG_ENDIAN == 0);
7859 HOST_WIDE_INT value = INTVAL (operands[1]);
7860
7861 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
7862 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
7863 #if HOST_BITS_PER_WIDE_INT == 32
7864 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
7865 #else
7866 operands[4] = GEN_INT (value >> 32);
7867 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
7868 #endif
7869 }")
7870
7871 (define_split
7872 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7873 (match_operand:DF 1 "const_double_operand" ""))]
7874 "! TARGET_POWERPC64 && reload_completed
7875 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7876 || (GET_CODE (operands[0]) == SUBREG
7877 && GET_CODE (SUBREG_REG (operands[0])) == REG
7878 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7879 [(set (match_dup 2) (match_dup 4))
7880 (set (match_dup 3) (match_dup 5))]
7881 "
7882 {
7883 int endian = (WORDS_BIG_ENDIAN == 0);
7884 long l[2];
7885 REAL_VALUE_TYPE rv;
7886
7887 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7888 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
7889
7890 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
7891 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
7892 operands[4] = gen_int_mode (l[endian], SImode);
7893 operands[5] = gen_int_mode (l[1 - endian], SImode);
7894 }")
7895
7896 (define_split
7897 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7898 (match_operand:DF 1 "easy_fp_constant" ""))]
7899 "TARGET_POWERPC64 && reload_completed
7900 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7901 || (GET_CODE (operands[0]) == SUBREG
7902 && GET_CODE (SUBREG_REG (operands[0])) == REG
7903 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7904 [(set (match_dup 2) (match_dup 3))]
7905 "
7906 {
7907 int endian = (WORDS_BIG_ENDIAN == 0);
7908 long l[2];
7909 REAL_VALUE_TYPE rv;
7910 HOST_WIDE_INT val;
7911
7912 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7913 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
7914
7915 operands[2] = gen_lowpart (DImode, operands[0]);
7916 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
7917 #if HOST_BITS_PER_WIDE_INT >= 64
7918 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32 |
7919 ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
7920
7921 operands[3] = immed_double_const (val, -(val < 0), DImode);
7922 #else
7923 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
7924 #endif
7925 }")
7926
7927 ;; Don't have reload use general registers to load a constant. First,
7928 ;; it might not work if the output operand is the equivalent of
7929 ;; a non-offsettable memref, but also it is less efficient than loading
7930 ;; the constant into an FP register, since it will probably be used there.
7931 ;; The "??" is a kludge until we can figure out a more reasonable way
7932 ;; of handling these non-offsettable values.
7933 (define_insn "*movdf_hardfloat32"
7934 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,!r,!r,!r,f,f,m")
7935 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F,f,m,f"))]
7936 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT
7937 && (gpc_reg_operand (operands[0], DFmode)
7938 || gpc_reg_operand (operands[1], DFmode))"
7939 "*
7940 {
7941 switch (which_alternative)
7942 {
7943 default:
7944 abort ();
7945 case 0:
7946 /* We normally copy the low-numbered register first. However, if
7947 the first register operand 0 is the same as the second register
7948 of operand 1, we must copy in the opposite order. */
7949 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
7950 return \"mr %L0,%L1\;mr %0,%1\";
7951 else
7952 return \"mr %0,%1\;mr %L0,%L1\";
7953 case 1:
7954 if (offsettable_memref_p (operands[1])
7955 || (GET_CODE (operands[1]) == MEM
7956 && (GET_CODE (XEXP (operands[1], 0)) == LO_SUM
7957 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
7958 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)))
7959 {
7960 /* If the low-address word is used in the address, we must load
7961 it last. Otherwise, load it first. Note that we cannot have
7962 auto-increment in that case since the address register is
7963 known to be dead. */
7964 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
7965 operands[1], 0))
7966 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
7967 else
7968 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
7969 }
7970 else
7971 {
7972 rtx addreg;
7973
7974 addreg = find_addr_reg (XEXP (operands[1], 0));
7975 if (refers_to_regno_p (REGNO (operands[0]),
7976 REGNO (operands[0]) + 1,
7977 operands[1], 0))
7978 {
7979 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
7980 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
7981 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
7982 return \"{lx|lwzx} %0,%1\";
7983 }
7984 else
7985 {
7986 output_asm_insn (\"{lx|lwzx} %0,%1\", operands);
7987 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
7988 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
7989 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
7990 return \"\";
7991 }
7992 }
7993 case 2:
7994 if (offsettable_memref_p (operands[0])
7995 || (GET_CODE (operands[0]) == MEM
7996 && (GET_CODE (XEXP (operands[0], 0)) == LO_SUM
7997 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
7998 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)))
7999 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8000 else
8001 {
8002 rtx addreg;
8003
8004 addreg = find_addr_reg (XEXP (operands[0], 0));
8005 output_asm_insn (\"{stx|stwx} %1,%0\", operands);
8006 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8007 output_asm_insn (\"{stx|stwx} %L1,%0\", operands);
8008 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8009 return \"\";
8010 }
8011 case 3:
8012 case 4:
8013 case 5:
8014 return \"#\";
8015 case 6:
8016 return \"fmr %0,%1\";
8017 case 7:
8018 return \"lfd%U1%X1 %0,%1\";
8019 case 8:
8020 return \"stfd%U0%X0 %1,%0\";
8021 }
8022 }"
8023 [(set_attr "type" "*,load,store,*,*,*,fp,fpload,fpstore")
8024 (set_attr "length" "8,16,16,8,12,16,*,*,*")])
8025
8026 (define_insn "*movdf_softfloat32"
8027 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8028 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8029 "! TARGET_POWERPC64 && TARGET_SOFT_FLOAT
8030 && (gpc_reg_operand (operands[0], DFmode)
8031 || gpc_reg_operand (operands[1], DFmode))"
8032 "*
8033 {
8034 switch (which_alternative)
8035 {
8036 default:
8037 abort ();
8038 case 0:
8039 /* We normally copy the low-numbered register first. However, if
8040 the first register operand 0 is the same as the second register of
8041 operand 1, we must copy in the opposite order. */
8042 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8043 return \"mr %L0,%L1\;mr %0,%1\";
8044 else
8045 return \"mr %0,%1\;mr %L0,%L1\";
8046 case 1:
8047 /* If the low-address word is used in the address, we must load
8048 it last. Otherwise, load it first. Note that we cannot have
8049 auto-increment in that case since the address register is
8050 known to be dead. */
8051 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8052 operands[1], 0))
8053 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8054 else
8055 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8056 case 2:
8057 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8058 case 3:
8059 case 4:
8060 case 5:
8061 return \"#\";
8062 }
8063 }"
8064 [(set_attr "type" "*,load,store,*,*,*")
8065 (set_attr "length" "8,8,8,8,12,16")])
8066
8067 (define_insn "*movdf_hardfloat64"
8068 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,!r,!r,!r,f,f,m")
8069 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F,f,m,f"))]
8070 "TARGET_POWERPC64 && TARGET_HARD_FLOAT
8071 && (gpc_reg_operand (operands[0], DFmode)
8072 || gpc_reg_operand (operands[1], DFmode))"
8073 "@
8074 mr %0,%1
8075 ld%U1%X1 %0,%1
8076 std%U0%X0 %1,%0
8077 #
8078 #
8079 #
8080 fmr %0,%1
8081 lfd%U1%X1 %0,%1
8082 stfd%U0%X0 %1,%0"
8083 [(set_attr "type" "*,load,store,*,*,*,fp,fpload,fpstore")
8084 (set_attr "length" "4,4,4,8,12,16,4,4,4")])
8085
8086 (define_insn "*movdf_softfloat64"
8087 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8088 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8089 "TARGET_POWERPC64 && TARGET_SOFT_FLOAT
8090 && (gpc_reg_operand (operands[0], DFmode)
8091 || gpc_reg_operand (operands[1], DFmode))"
8092 "@
8093 mr %0,%1
8094 ld%U1%X1 %0,%1
8095 std%U0%X0 %1,%0
8096 #
8097 #
8098 #"
8099 [(set_attr "type" "*,load,store,*,*,*")
8100 (set_attr "length" "*,*,*,8,12,16")])
8101 \f
8102 (define_expand "movtf"
8103 [(set (match_operand:TF 0 "general_operand" "")
8104 (match_operand:TF 1 "any_operand" ""))]
8105 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_LONG_DOUBLE_128"
8106 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
8107
8108 (define_insn "*movtf_internal"
8109 [(set (match_operand:TF 0 "nonimmediate_operand" "=f,f,m,!r,!r,!r")
8110 (match_operand:TF 1 "input_operand" "f,m,f,G,H,F"))]
8111 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_LONG_DOUBLE_128
8112 && (gpc_reg_operand (operands[0], TFmode)
8113 || gpc_reg_operand (operands[1], TFmode))"
8114 "*
8115 {
8116 switch (which_alternative)
8117 {
8118 default:
8119 abort ();
8120 case 0:
8121 /* We normally copy the low-numbered register first. However, if
8122 the first register operand 0 is the same as the second register of
8123 operand 1, we must copy in the opposite order. */
8124 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8125 return \"fmr %L0,%L1\;fmr %0,%1\";
8126 else
8127 return \"fmr %0,%1\;fmr %L0,%L1\";
8128 case 1:
8129 return \"lfd %0,%1\;lfd %L0,%L1\";
8130 case 2:
8131 return \"stfd %1,%0\;stfd %L1,%L0\";
8132 case 3:
8133 case 4:
8134 case 5:
8135 return \"#\";
8136 }
8137 }"
8138 [(set_attr "type" "fp,fpload,fpstore,*,*,*")
8139 (set_attr "length" "8,8,8,12,16,20")])
8140
8141 (define_split
8142 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8143 (match_operand:TF 1 "const_double_operand" ""))]
8144 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_LONG_DOUBLE_128"
8145 [(set (match_dup 3) (match_dup 1))
8146 (set (match_dup 0)
8147 (float_extend:TF (match_dup 3)))]
8148 "
8149 {
8150 operands[2] = operand_subword (operands[1], 0, 0, DFmode);
8151 operands[3] = gen_reg_rtx (DFmode);
8152 }")
8153
8154 (define_insn_and_split "extenddftf2"
8155 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8156 (float_extend:TF (match_operand:DF 1 "gpc_reg_operand" "f")))]
8157 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_LONG_DOUBLE_128"
8158 "#"
8159 ""
8160 [(set (match_dup 2) (match_dup 3))]
8161 "
8162 {
8163 operands[2] = gen_rtx_REG (DFmode, REGNO (operands[0] + 1));
8164 operands[3] = CONST0_RTX (DFmode);
8165 }")
8166
8167 (define_insn_and_split "extendsftf2"
8168 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8169 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "f")))]
8170 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_LONG_DOUBLE_128"
8171 "#"
8172 ""
8173 [(set (match_dup 2) (match_dup 3))]
8174 "
8175 {
8176 operands[2] = gen_rtx_REG (SFmode, REGNO (operands[0] + 1));
8177 operands[3] = CONST0_RTX (SFmode);
8178 }")
8179
8180 (define_insn "trunctfdf2"
8181 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8182 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8183 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_LONG_DOUBLE_128"
8184 "fadd %0,%1,%L1"
8185 [(set_attr "type" "fp")
8186 (set_attr "length" "8")])
8187
8188 (define_insn_and_split "trunctfsf2"
8189 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8190 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
8191 (clobber (match_scratch:DF 2 "=f"))]
8192 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_LONG_DOUBLE_128"
8193 "#"
8194 "&& reload_completed"
8195 [(set (match_dup 2)
8196 (float_truncate:DF (match_dup 1)))
8197 (set (match_dup 0)
8198 (float_truncate:SF (match_dup 2)))]
8199 "")
8200
8201 (define_insn_and_split "floatditf2"
8202 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8203 (float:TF (match_operand:DI 1 "gpc_reg_operand" "f")))
8204 (clobber (match_scratch:DF 2 "=f"))]
8205 "DEFAULT_ABI == ABI_AIX && TARGET_POWERPC64
8206 && TARGET_HARD_FLOAT && TARGET_LONG_DOUBLE_128"
8207 "#"
8208 "&& reload_completed"
8209 [(set (match_dup 2)
8210 (float:DF (match_operand:DI 1 "gpc_reg_operand" "")))
8211 (set (match_operand:TF 0 "gpc_reg_operand" "")
8212 (float_extend:TF (match_dup 2)))]
8213 "")
8214
8215 (define_insn_and_split "floatsitf2"
8216 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8217 (float:TF (match_operand:SI 1 "gpc_reg_operand" "f")))
8218 (clobber (match_scratch:DF 2 "=f"))]
8219 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_LONG_DOUBLE_128"
8220 "#"
8221 "&& reload_completed"
8222 [(set (match_dup 2)
8223 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
8224 (set (match_operand:TF 0 "gpc_reg_operand" "")
8225 (float_extend:TF (match_dup 2)))]
8226 "")
8227
8228 (define_insn_and_split "fix_trunctfdi2"
8229 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
8230 (fix:DI (match_operand:TF 1 "gpc_reg_operand" "f")))]
8231 "DEFAULT_ABI == ABI_AIX && TARGET_POWERPC64
8232 && TARGET_HARD_FLOAT && TARGET_LONG_DOUBLE_128"
8233 "#"
8234 "&& reload_completed"
8235 [(set (match_dup 2)
8236 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))
8237 (set (match_operand:DI 0 "gpc_reg_operand" "")
8238 (fix:SI (match_dup 2)))]
8239 "")
8240
8241 (define_insn_and_split "fix_trunctfsi2"
8242 [(set (match_operand:SI 0 "gpc_reg_operand" "=f")
8243 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))]
8244 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_LONG_DOUBLE_128"
8245 "#"
8246 "&& reload_completed"
8247 [(set (match_dup 2)
8248 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))
8249 (set (match_operand:SI 0 "gpc_reg_operand" "")
8250 (fix:SI (match_dup 2)))]
8251 "")
8252
8253 (define_insn "negtf2"
8254 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8255 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8256 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_LONG_DOUBLE_128"
8257 "*
8258 {
8259 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8260 return \"fneg %L0,%L1\;fneg %0,%1\";
8261 else
8262 return \"fneg %0,%1\;fneg %L0,%L1\";
8263 }"
8264 [(set_attr "type" "fp")
8265 (set_attr "length" "8")])
8266
8267 (define_insn "abstf2"
8268 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8269 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8270 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_LONG_DOUBLE_128"
8271 "*
8272 {
8273 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8274 return \"fabs %L0,%L1\;fabs %0,%1\";
8275 else
8276 return \"fabs %0,%1\;fabs %L0,%L1\";
8277 }"
8278 [(set_attr "type" "fp")
8279 (set_attr "length" "8")])
8280
8281 (define_insn ""
8282 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8283 (neg:TF (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f"))))]
8284 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_LONG_DOUBLE_128"
8285 "*
8286 {
8287 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8288 return \"fnabs %L0,%L1\;fnabs %0,%1\";
8289 else
8290 return \"fnabs %0,%1\;fnabs %L0,%L1\";
8291 }"
8292 [(set_attr "type" "fp")
8293 (set_attr "length" "8")])
8294 \f
8295 ;; Next come the multi-word integer load and store and the load and store
8296 ;; multiple insns.
8297 (define_expand "movdi"
8298 [(set (match_operand:DI 0 "general_operand" "")
8299 (match_operand:DI 1 "any_operand" ""))]
8300 ""
8301 "{ rs6000_emit_move (operands[0], operands[1], DImode); DONE; }")
8302
8303 (define_insn "*movdi_internal32"
8304 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,f,f,m,r,r,r,r,r")
8305 (match_operand:DI 1 "input_operand" "r,m,r,f,m,f,IJK,n,G,H,F"))]
8306 "! TARGET_POWERPC64
8307 && (gpc_reg_operand (operands[0], DImode)
8308 || gpc_reg_operand (operands[1], DImode))"
8309 "*
8310 {
8311 switch (which_alternative)
8312 {
8313 default:
8314 abort ();
8315 case 0:
8316 /* We normally copy the low-numbered register first. However, if
8317 the first register operand 0 is the same as the second register of
8318 operand 1, we must copy in the opposite order. */
8319 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8320 return \"mr %L0,%L1\;mr %0,%1\";
8321 else
8322 return \"mr %0,%1\;mr %L0,%L1\";
8323 case 1:
8324 /* If the low-address word is used in the address, we must load it
8325 last. Otherwise, load it first. Note that we cannot have
8326 auto-increment in that case since the address register is known to be
8327 dead. */
8328 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8329 operands[1], 0))
8330 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8331 else
8332 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8333 case 2:
8334 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8335 case 3:
8336 return \"fmr %0,%1\";
8337 case 4:
8338 return \"lfd%U1%X1 %0,%1\";
8339 case 5:
8340 return \"stfd%U0%X0 %1,%0\";
8341 case 6:
8342 case 7:
8343 case 8:
8344 case 9:
8345 case 10:
8346 return \"#\";
8347 }
8348 }"
8349 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*,*,*,*")
8350 (set_attr "length" "8,8,8,*,*,*,8,12,8,12,16")])
8351
8352 (define_split
8353 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8354 (match_operand:DI 1 "const_int_operand" ""))]
8355 "! TARGET_POWERPC64 && reload_completed"
8356 [(set (match_dup 2) (match_dup 4))
8357 (set (match_dup 3) (match_dup 1))]
8358 "
8359 {
8360 HOST_WIDE_INT value = INTVAL (operands[1]);
8361 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8362 DImode);
8363 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8364 DImode);
8365 #if HOST_BITS_PER_WIDE_INT == 32
8366 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8367 #else
8368 operands[4] = GEN_INT (value >> 32);
8369 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8370 #endif
8371 }")
8372
8373 (define_split
8374 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8375 (match_operand:DI 1 "const_double_operand" ""))]
8376 "HOST_BITS_PER_WIDE_INT == 32 && ! TARGET_POWERPC64 && reload_completed"
8377 [(set (match_dup 2) (match_dup 4))
8378 (set (match_dup 3) (match_dup 5))]
8379 "
8380 {
8381 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8382 DImode);
8383 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8384 DImode);
8385 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
8386 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
8387 }")
8388
8389 (define_insn "*movdi_internal64"
8390 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,f,f,m,r,*h,*h")
8391 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
8392 "TARGET_POWERPC64
8393 && (gpc_reg_operand (operands[0], DImode)
8394 || gpc_reg_operand (operands[1], DImode))"
8395 "@
8396 mr %0,%1
8397 ld%U1%X1 %0,%1
8398 std%U0%X0 %1,%0
8399 li %0,%1
8400 lis %0,%v1
8401 #
8402 {cal|la} %0,%a1
8403 fmr %0,%1
8404 lfd%U1%X1 %0,%1
8405 stfd%U0%X0 %1,%0
8406 mf%1 %0
8407 mt%0 %1
8408 cror 0,0,0"
8409 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,*,mtjmpr,*")
8410 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
8411
8412 ;; immediate value valid for a single instruction hiding in a const_double
8413 (define_insn ""
8414 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8415 (match_operand:DI 1 "const_double_operand" "F"))]
8416 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
8417 && GET_CODE (operands[1]) == CONST_DOUBLE
8418 && num_insns_constant (operands[1], DImode) == 1"
8419 "*
8420 {
8421 return ((unsigned HOST_WIDE_INT)
8422 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
8423 ? \"li %0,%1\" : \"lis %0,%v1\";
8424 }")
8425
8426 ;; Generate all one-bits and clear left or right.
8427 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
8428 (define_split
8429 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8430 (match_operand:DI 1 "mask64_operand" ""))]
8431 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8432 [(set (match_dup 0) (const_int -1))
8433 (set (match_dup 0)
8434 (and:DI (rotate:DI (match_dup 0)
8435 (const_int 0))
8436 (match_dup 1)))]
8437 "")
8438
8439 ;; Split a load of a large constant into the appropriate five-instruction
8440 ;; sequence. Handle anything in a constant number of insns.
8441 ;; When non-easy constants can go in the TOC, this should use
8442 ;; easy_fp_constant predicate.
8443 (define_split
8444 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8445 (match_operand:DI 1 "const_int_operand" ""))]
8446 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8447 [(set (match_dup 0) (match_dup 2))
8448 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8449 "
8450 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8451
8452 if (tem == operands[0])
8453 DONE;
8454 else
8455 FAIL;
8456 }")
8457
8458 (define_split
8459 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8460 (match_operand:DI 1 "const_double_operand" ""))]
8461 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8462 [(set (match_dup 0) (match_dup 2))
8463 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8464 "
8465 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8466
8467 if (tem == operands[0])
8468 DONE;
8469 else
8470 FAIL;
8471 }")
8472
8473 ;; Split a load of a large constant into the appropriate five-instruction
8474 (define_insn "*movdi_internal2"
8475 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
8476 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r,r")
8477 (const_int 0)))
8478 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r") (match_dup 1))]
8479 "TARGET_POWERPC64"
8480 "@
8481 mr. %0,%1
8482 #"
8483 [(set_attr "type" "compare")
8484 (set_attr "length" "4,8")])
8485
8486 (define_split
8487 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
8488 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "")
8489 (const_int 0)))
8490 (set (match_operand:DI 0 "gpc_reg_operand" "") (match_dup 1))]
8491 "TARGET_POWERPC64 && reload_completed"
8492 [(set (match_dup 0) (match_dup 1))
8493 (set (match_dup 2)
8494 (compare:CC (match_dup 0)
8495 (const_int 0)))]
8496 "")
8497 \f
8498 ;; TImode is similar, except that we usually want to compute the address into
8499 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
8500 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
8501 (define_expand "movti"
8502 [(parallel [(set (match_operand:TI 0 "general_operand" "")
8503 (match_operand:TI 1 "general_operand" ""))
8504 (clobber (scratch:SI))])]
8505 "TARGET_STRING || TARGET_POWERPC64"
8506 "{ rs6000_emit_move (operands[0], operands[1], TImode); DONE; }")
8507
8508 ;; We say that MQ is clobbered in the last alternative because the first
8509 ;; alternative would never get used otherwise since it would need a reload
8510 ;; while the 2nd alternative would not. We put memory cases first so they
8511 ;; are preferred. Otherwise, we'd try to reload the output instead of
8512 ;; giving the SCRATCH mq.
8513 (define_insn "*movti_power"
8514 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r")
8515 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))
8516 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X"))]
8517 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
8518 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8519 "*
8520 {
8521 switch (which_alternative)
8522 {
8523 default:
8524 abort ();
8525
8526 case 0:
8527 return \"{stsi|stswi} %1,%P0,16\";
8528
8529 case 1:
8530 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
8531
8532 case 2:
8533 /* Normally copy registers with lowest numbered register copied first.
8534 But copy in the other order if the first register of the output
8535 is the second, third, or fourth register in the input. */
8536 if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
8537 && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
8538 return \"mr %Z0,%Z1\;mr %Y0,%Y1\;mr %L0,%L1\;mr %0,%1\";
8539 else
8540 return \"mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1\";
8541 case 3:
8542 /* If the address is not used in the output, we can use lsi. Otherwise,
8543 fall through to generating four loads. */
8544 if (! reg_overlap_mentioned_p (operands[0], operands[1]))
8545 return \"{lsi|lswi} %0,%P1,16\";
8546 /* ... fall through ... */
8547 case 4:
8548 /* If the address register is the same as the register for the lowest-
8549 addressed word, load it last. Similarly for the next two words.
8550 Otherwise load lowest address to highest. */
8551 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8552 operands[1], 0))
8553 return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
8554 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
8555 REGNO (operands[0]) + 2, operands[1], 0))
8556 return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
8557 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
8558 REGNO (operands[0]) + 3, operands[1], 0))
8559 return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
8560 else
8561 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
8562 }
8563 }"
8564 [(set_attr "type" "store,store,*,load,load")
8565 (set_attr "length" "*,16,16,*,16")])
8566
8567 (define_insn "*movti_string"
8568 [(set (match_operand:TI 0 "reg_or_mem_operand" "=m,????r,????r")
8569 (match_operand:TI 1 "reg_or_mem_operand" "r,r,m"))
8570 (clobber (match_scratch:SI 2 "=X,X,X"))]
8571 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
8572 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8573 "*
8574 {
8575 switch (which_alternative)
8576 {
8577 default:
8578 abort ();
8579
8580 case 0:
8581 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
8582
8583 case 1:
8584 /* Normally copy registers with lowest numbered register copied first.
8585 But copy in the other order if the first register of the output
8586 is the second, third, or fourth register in the input. */
8587 if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
8588 && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
8589 return \"mr %Z0,%Z1\;mr %Y0,%Y1\;mr %L0,%L1\;mr %0,%1\";
8590 else
8591 return \"mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1\";
8592 case 2:
8593 /* If the address register is the same as the register for the lowest-
8594 addressed word, load it last. Similarly for the next two words.
8595 Otherwise load lowest address to highest. */
8596 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8597 operands[1], 0))
8598 return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
8599 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
8600 REGNO (operands[0]) + 2, operands[1], 0))
8601 return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
8602 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
8603 REGNO (operands[0]) + 3, operands[1], 0))
8604 return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
8605 else
8606 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
8607 }
8608 }"
8609 [(set_attr "type" "store,*,load")
8610 (set_attr "length" "16,16,16")])
8611
8612 (define_insn "*movti_ppc64"
8613 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,r,m")
8614 (match_operand:TI 1 "input_operand" "r,m,r"))]
8615 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
8616 || gpc_reg_operand (operands[1], TImode))"
8617 "*
8618 {
8619 switch (which_alternative)
8620 {
8621 default:
8622 abort ();
8623 case 0:
8624 /* We normally copy the low-numbered register first. However, if
8625 the first register operand 0 is the same as the second register of
8626 operand 1, we must copy in the opposite order. */
8627 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8628 return \"mr %L0,%L1\;mr %0,%1\";
8629 else
8630 return \"mr %0,%1\;mr %L0,%L1\";
8631 case 1:
8632 /* If the low-address word is used in the address, we must load it
8633 last. Otherwise, load it first. Note that we cannot have
8634 auto-increment in that case since the address register is known to be
8635 dead. */
8636 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8637 operands[1], 0))
8638 return \"ld %L0,%L1\;ld %0,%1\";
8639 else
8640 return \"ld%U1 %0,%1\;ld %L0,%L1\";
8641 case 2:
8642 return \"std%U0 %1,%0\;std %L1,%L0\";
8643 }
8644 }"
8645 [(set_attr "type" "*,load,store")
8646 (set_attr "length" "8,8,8")])
8647 \f
8648 (define_expand "load_multiple"
8649 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8650 (match_operand:SI 1 "" ""))
8651 (use (match_operand:SI 2 "" ""))])]
8652 "TARGET_STRING && !TARGET_POWERPC64"
8653 "
8654 {
8655 int regno;
8656 int count;
8657 rtx op1;
8658 int i;
8659
8660 /* Support only loading a constant number of fixed-point registers from
8661 memory and only bother with this if more than two; the machine
8662 doesn't support more than eight. */
8663 if (GET_CODE (operands[2]) != CONST_INT
8664 || INTVAL (operands[2]) <= 2
8665 || INTVAL (operands[2]) > 8
8666 || GET_CODE (operands[1]) != MEM
8667 || GET_CODE (operands[0]) != REG
8668 || REGNO (operands[0]) >= 32)
8669 FAIL;
8670
8671 count = INTVAL (operands[2]);
8672 regno = REGNO (operands[0]);
8673
8674 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
8675 op1 = replace_equiv_address (operands[1],
8676 force_reg (SImode, XEXP (operands[1], 0)));
8677
8678 for (i = 0; i < count; i++)
8679 XVECEXP (operands[3], 0, i)
8680 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
8681 adjust_address (op1, SImode, i * 4));
8682 }")
8683
8684 (define_insn ""
8685 [(match_parallel 0 "load_multiple_operation"
8686 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
8687 (mem:SI (match_operand:SI 2 "gpc_reg_operand" "b")))])]
8688 "TARGET_STRING"
8689 "*
8690 {
8691 /* We have to handle the case where the pseudo used to contain the address
8692 is assigned to one of the output registers. */
8693 int i, j;
8694 int words = XVECLEN (operands[0], 0);
8695 rtx xop[10];
8696
8697 if (XVECLEN (operands[0], 0) == 1)
8698 return \"{l|lwz} %1,0(%2)\";
8699
8700 for (i = 0; i < words; i++)
8701 if (refers_to_regno_p (REGNO (operands[1]) + i,
8702 REGNO (operands[1]) + i + 1, operands[2], 0))
8703 {
8704 if (i == words-1)
8705 {
8706 xop[0] = operands[1];
8707 xop[1] = operands[2];
8708 xop[2] = GEN_INT (4 * (words-1));
8709 output_asm_insn (\"{lsi|lswi} %0,%1,%2\;{l|lwz} %1,%2(%1)\", xop);
8710 return \"\";
8711 }
8712 else if (i == 0)
8713 {
8714 xop[0] = operands[1];
8715 xop[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
8716 xop[2] = GEN_INT (4 * (words-1));
8717 output_asm_insn (\"{cal %0,4(%0)|addi %0,%0,4}\;{lsi|lswi} %1,%0,%2\;{l|lwz} %0,-4(%0)\", xop);
8718 return \"\";
8719 }
8720 else
8721 {
8722 for (j = 0; j < words; j++)
8723 if (j != i)
8724 {
8725 xop[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + j);
8726 xop[1] = operands[2];
8727 xop[2] = GEN_INT (j * 4);
8728 output_asm_insn (\"{l|lwz} %0,%2(%1)\", xop);
8729 }
8730 xop[0] = operands[2];
8731 xop[1] = GEN_INT (i * 4);
8732 output_asm_insn (\"{l|lwz} %0,%1(%0)\", xop);
8733 return \"\";
8734 }
8735 }
8736
8737 return \"{lsi|lswi} %1,%2,%N0\";
8738 }"
8739 [(set_attr "type" "load")
8740 (set_attr "length" "32")])
8741
8742 \f
8743 (define_expand "store_multiple"
8744 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8745 (match_operand:SI 1 "" ""))
8746 (clobber (scratch:SI))
8747 (use (match_operand:SI 2 "" ""))])]
8748 "TARGET_STRING && !TARGET_POWERPC64"
8749 "
8750 {
8751 int regno;
8752 int count;
8753 rtx to;
8754 rtx op0;
8755 int i;
8756
8757 /* Support only storing a constant number of fixed-point registers to
8758 memory and only bother with this if more than two; the machine
8759 doesn't support more than eight. */
8760 if (GET_CODE (operands[2]) != CONST_INT
8761 || INTVAL (operands[2]) <= 2
8762 || INTVAL (operands[2]) > 8
8763 || GET_CODE (operands[0]) != MEM
8764 || GET_CODE (operands[1]) != REG
8765 || REGNO (operands[1]) >= 32)
8766 FAIL;
8767
8768 count = INTVAL (operands[2]);
8769 regno = REGNO (operands[1]);
8770
8771 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
8772 to = force_reg (SImode, XEXP (operands[0], 0));
8773 op0 = replace_equiv_address (operands[0], to);
8774
8775 XVECEXP (operands[3], 0, 0)
8776 = gen_rtx_SET (VOIDmode, adjust_address (op0, SImode, 0), operands[1]);
8777 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
8778 gen_rtx_SCRATCH (SImode));
8779
8780 for (i = 1; i < count; i++)
8781 XVECEXP (operands[3], 0, i + 1)
8782 = gen_rtx_SET (VOIDmode,
8783 adjust_address (op0, SImode, i * 4),
8784 gen_rtx_REG (SImode, regno + i));
8785 }")
8786
8787 (define_insn ""
8788 [(match_parallel 0 "store_multiple_operation"
8789 [(set (match_operand:SI 1 "indirect_operand" "=Q")
8790 (match_operand:SI 2 "gpc_reg_operand" "r"))
8791 (clobber (match_scratch:SI 3 "=q"))])]
8792 "TARGET_STRING && TARGET_POWER"
8793 "{stsi|stswi} %2,%P1,%O0"
8794 [(set_attr "type" "store")])
8795
8796 (define_insn ""
8797 [(match_parallel 0 "store_multiple_operation"
8798 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8799 (match_operand:SI 2 "gpc_reg_operand" "r"))
8800 (clobber (match_scratch:SI 3 "X"))])]
8801 "TARGET_STRING && ! TARGET_POWER"
8802 "{stsi|stswi} %2,%1,%O0"
8803 [(set_attr "type" "store")])
8804
8805 \f
8806 ;; String/block move insn.
8807 ;; Argument 0 is the destination
8808 ;; Argument 1 is the source
8809 ;; Argument 2 is the length
8810 ;; Argument 3 is the alignment
8811
8812 (define_expand "movstrsi"
8813 [(parallel [(set (match_operand:BLK 0 "" "")
8814 (match_operand:BLK 1 "" ""))
8815 (use (match_operand:SI 2 "" ""))
8816 (use (match_operand:SI 3 "" ""))])]
8817 ""
8818 "
8819 {
8820 if (expand_block_move (operands))
8821 DONE;
8822 else
8823 FAIL;
8824 }")
8825
8826 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
8827 ;; register allocator doesn't have a clue about allocating 8 word registers.
8828 ;; rD/rS = r5 is preferred, efficient form.
8829 (define_expand "movstrsi_8reg"
8830 [(parallel [(set (match_operand 0 "" "")
8831 (match_operand 1 "" ""))
8832 (use (match_operand 2 "" ""))
8833 (use (match_operand 3 "" ""))
8834 (clobber (reg:SI 5))
8835 (clobber (reg:SI 6))
8836 (clobber (reg:SI 7))
8837 (clobber (reg:SI 8))
8838 (clobber (reg:SI 9))
8839 (clobber (reg:SI 10))
8840 (clobber (reg:SI 11))
8841 (clobber (reg:SI 12))
8842 (clobber (match_scratch:SI 4 ""))])]
8843 "TARGET_STRING"
8844 "")
8845
8846 (define_insn ""
8847 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8848 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8849 (use (match_operand:SI 2 "immediate_operand" "i"))
8850 (use (match_operand:SI 3 "immediate_operand" "i"))
8851 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8852 (clobber (reg:SI 6))
8853 (clobber (reg:SI 7))
8854 (clobber (reg:SI 8))
8855 (clobber (reg:SI 9))
8856 (clobber (reg:SI 10))
8857 (clobber (reg:SI 11))
8858 (clobber (reg:SI 12))
8859 (clobber (match_scratch:SI 5 "=q"))]
8860 "TARGET_STRING && TARGET_POWER
8861 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
8862 || INTVAL (operands[2]) == 0)
8863 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
8864 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
8865 && REGNO (operands[4]) == 5"
8866 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8867 [(set_attr "type" "load")
8868 (set_attr "length" "8")])
8869
8870 (define_insn ""
8871 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8872 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8873 (use (match_operand:SI 2 "immediate_operand" "i"))
8874 (use (match_operand:SI 3 "immediate_operand" "i"))
8875 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8876 (clobber (reg:SI 6))
8877 (clobber (reg:SI 7))
8878 (clobber (reg:SI 8))
8879 (clobber (reg:SI 9))
8880 (clobber (reg:SI 10))
8881 (clobber (reg:SI 11))
8882 (clobber (reg:SI 12))
8883 (clobber (match_scratch:SI 5 "X"))]
8884 "TARGET_STRING && ! TARGET_POWER
8885 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
8886 || INTVAL (operands[2]) == 0)
8887 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
8888 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
8889 && REGNO (operands[4]) == 5"
8890 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8891 [(set_attr "type" "load")
8892 (set_attr "length" "8")])
8893
8894 (define_insn ""
8895 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
8896 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
8897 (use (match_operand:SI 2 "immediate_operand" "i"))
8898 (use (match_operand:SI 3 "immediate_operand" "i"))
8899 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8900 (clobber (reg:SI 6))
8901 (clobber (reg:SI 7))
8902 (clobber (reg:SI 8))
8903 (clobber (reg:SI 9))
8904 (clobber (reg:SI 10))
8905 (clobber (reg:SI 11))
8906 (clobber (reg:SI 12))
8907 (clobber (match_scratch:SI 5 "X"))]
8908 "TARGET_STRING && TARGET_POWERPC64
8909 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
8910 || INTVAL (operands[2]) == 0)
8911 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
8912 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
8913 && REGNO (operands[4]) == 5"
8914 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8915 [(set_attr "type" "load")
8916 (set_attr "length" "8")])
8917
8918 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
8919 ;; register allocator doesn't have a clue about allocating 6 word registers.
8920 ;; rD/rS = r5 is preferred, efficient form.
8921 (define_expand "movstrsi_6reg"
8922 [(parallel [(set (match_operand 0 "" "")
8923 (match_operand 1 "" ""))
8924 (use (match_operand 2 "" ""))
8925 (use (match_operand 3 "" ""))
8926 (clobber (reg:SI 5))
8927 (clobber (reg:SI 6))
8928 (clobber (reg:SI 7))
8929 (clobber (reg:SI 8))
8930 (clobber (reg:SI 9))
8931 (clobber (reg:SI 10))
8932 (clobber (match_scratch:SI 4 ""))])]
8933 "TARGET_STRING"
8934 "")
8935
8936 (define_insn ""
8937 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8938 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8939 (use (match_operand:SI 2 "immediate_operand" "i"))
8940 (use (match_operand:SI 3 "immediate_operand" "i"))
8941 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8942 (clobber (reg:SI 6))
8943 (clobber (reg:SI 7))
8944 (clobber (reg:SI 8))
8945 (clobber (reg:SI 9))
8946 (clobber (reg:SI 10))
8947 (clobber (match_scratch:SI 5 "=q"))]
8948 "TARGET_STRING && TARGET_POWER
8949 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
8950 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
8951 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
8952 && REGNO (operands[4]) == 5"
8953 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8954 [(set_attr "type" "load")
8955 (set_attr "length" "8")])
8956
8957 (define_insn ""
8958 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8959 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8960 (use (match_operand:SI 2 "immediate_operand" "i"))
8961 (use (match_operand:SI 3 "immediate_operand" "i"))
8962 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8963 (clobber (reg:SI 6))
8964 (clobber (reg:SI 7))
8965 (clobber (reg:SI 8))
8966 (clobber (reg:SI 9))
8967 (clobber (reg:SI 10))
8968 (clobber (match_scratch:SI 5 "X"))]
8969 "TARGET_STRING && ! TARGET_POWER
8970 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
8971 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
8972 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
8973 && REGNO (operands[4]) == 5"
8974 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8975 [(set_attr "type" "load")
8976 (set_attr "length" "8")])
8977
8978 (define_insn ""
8979 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
8980 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
8981 (use (match_operand:SI 2 "immediate_operand" "i"))
8982 (use (match_operand:SI 3 "immediate_operand" "i"))
8983 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8984 (clobber (reg:SI 6))
8985 (clobber (reg:SI 7))
8986 (clobber (reg:SI 8))
8987 (clobber (reg:SI 9))
8988 (clobber (reg:SI 10))
8989 (clobber (match_scratch:SI 5 "X"))]
8990 "TARGET_STRING && TARGET_POWERPC64
8991 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
8992 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
8993 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
8994 && REGNO (operands[4]) == 5"
8995 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8996 [(set_attr "type" "load")
8997 (set_attr "length" "8")])
8998
8999 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9000 ;; problems with TImode.
9001 ;; rD/rS = r5 is preferred, efficient form.
9002 (define_expand "movstrsi_4reg"
9003 [(parallel [(set (match_operand 0 "" "")
9004 (match_operand 1 "" ""))
9005 (use (match_operand 2 "" ""))
9006 (use (match_operand 3 "" ""))
9007 (clobber (reg:SI 5))
9008 (clobber (reg:SI 6))
9009 (clobber (reg:SI 7))
9010 (clobber (reg:SI 8))
9011 (clobber (match_scratch:SI 4 ""))])]
9012 "TARGET_STRING"
9013 "")
9014
9015 (define_insn ""
9016 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9017 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9018 (use (match_operand:SI 2 "immediate_operand" "i"))
9019 (use (match_operand:SI 3 "immediate_operand" "i"))
9020 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9021 (clobber (reg:SI 6))
9022 (clobber (reg:SI 7))
9023 (clobber (reg:SI 8))
9024 (clobber (match_scratch:SI 5 "=q"))]
9025 "TARGET_STRING && TARGET_POWER
9026 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9027 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9028 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9029 && REGNO (operands[4]) == 5"
9030 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9031 [(set_attr "type" "load")
9032 (set_attr "length" "8")])
9033
9034 (define_insn ""
9035 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9036 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9037 (use (match_operand:SI 2 "immediate_operand" "i"))
9038 (use (match_operand:SI 3 "immediate_operand" "i"))
9039 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9040 (clobber (reg:SI 6))
9041 (clobber (reg:SI 7))
9042 (clobber (reg:SI 8))
9043 (clobber (match_scratch:SI 5 "X"))]
9044 "TARGET_STRING && ! TARGET_POWER
9045 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9046 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9047 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9048 && REGNO (operands[4]) == 5"
9049 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9050 [(set_attr "type" "load")
9051 (set_attr "length" "8")])
9052
9053 (define_insn ""
9054 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9055 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9056 (use (match_operand:SI 2 "immediate_operand" "i"))
9057 (use (match_operand:SI 3 "immediate_operand" "i"))
9058 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9059 (clobber (reg:SI 6))
9060 (clobber (reg:SI 7))
9061 (clobber (reg:SI 8))
9062 (clobber (match_scratch:SI 5 "X"))]
9063 "TARGET_STRING && TARGET_POWERPC64
9064 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9065 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9066 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9067 && REGNO (operands[4]) == 5"
9068 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9069 [(set_attr "type" "load")
9070 (set_attr "length" "8")])
9071
9072 ;; Move up to 8 bytes at a time.
9073 (define_expand "movstrsi_2reg"
9074 [(parallel [(set (match_operand 0 "" "")
9075 (match_operand 1 "" ""))
9076 (use (match_operand 2 "" ""))
9077 (use (match_operand 3 "" ""))
9078 (clobber (match_scratch:DI 4 ""))
9079 (clobber (match_scratch:SI 5 ""))])]
9080 "TARGET_STRING && ! TARGET_POWERPC64"
9081 "")
9082
9083 (define_insn ""
9084 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9085 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9086 (use (match_operand:SI 2 "immediate_operand" "i"))
9087 (use (match_operand:SI 3 "immediate_operand" "i"))
9088 (clobber (match_scratch:DI 4 "=&r"))
9089 (clobber (match_scratch:SI 5 "=q"))]
9090 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9091 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9092 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9093 [(set_attr "type" "load")
9094 (set_attr "length" "8")])
9095
9096 (define_insn ""
9097 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9098 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9099 (use (match_operand:SI 2 "immediate_operand" "i"))
9100 (use (match_operand:SI 3 "immediate_operand" "i"))
9101 (clobber (match_scratch:DI 4 "=&r"))
9102 (clobber (match_scratch:SI 5 "X"))]
9103 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
9104 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9105 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9106 [(set_attr "type" "load")
9107 (set_attr "length" "8")])
9108
9109 ;; Move up to 4 bytes at a time.
9110 (define_expand "movstrsi_1reg"
9111 [(parallel [(set (match_operand 0 "" "")
9112 (match_operand 1 "" ""))
9113 (use (match_operand 2 "" ""))
9114 (use (match_operand 3 "" ""))
9115 (clobber (match_scratch:SI 4 ""))
9116 (clobber (match_scratch:SI 5 ""))])]
9117 "TARGET_STRING"
9118 "")
9119
9120 (define_insn ""
9121 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9122 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9123 (use (match_operand:SI 2 "immediate_operand" "i"))
9124 (use (match_operand:SI 3 "immediate_operand" "i"))
9125 (clobber (match_scratch:SI 4 "=&r"))
9126 (clobber (match_scratch:SI 5 "=q"))]
9127 "TARGET_STRING && TARGET_POWER
9128 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9129 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9130 [(set_attr "type" "load")
9131 (set_attr "length" "8")])
9132
9133 (define_insn ""
9134 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9135 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9136 (use (match_operand:SI 2 "immediate_operand" "i"))
9137 (use (match_operand:SI 3 "immediate_operand" "i"))
9138 (clobber (match_scratch:SI 4 "=&r"))
9139 (clobber (match_scratch:SI 5 "X"))]
9140 "TARGET_STRING && ! TARGET_POWER
9141 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9142 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9143 [(set_attr "type" "load")
9144 (set_attr "length" "8")])
9145
9146 (define_insn ""
9147 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9148 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9149 (use (match_operand:SI 2 "immediate_operand" "i"))
9150 (use (match_operand:SI 3 "immediate_operand" "i"))
9151 (clobber (match_scratch:SI 4 "=&r"))
9152 (clobber (match_scratch:SI 5 "X"))]
9153 "TARGET_STRING && TARGET_POWERPC64
9154 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9155 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9156 [(set_attr "type" "load")
9157 (set_attr "length" "8")])
9158
9159 \f
9160 ;; Define insns that do load or store with update. Some of these we can
9161 ;; get by using pre-decrement or pre-increment, but the hardware can also
9162 ;; do cases where the increment is not the size of the object.
9163 ;;
9164 ;; In all these cases, we use operands 0 and 1 for the register being
9165 ;; incremented because those are the operands that local-alloc will
9166 ;; tie and these are the pair most likely to be tieable (and the ones
9167 ;; that will benefit the most).
9168
9169 (define_insn "*movdi_update1"
9170 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
9171 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9172 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
9173 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9174 (plus:DI (match_dup 1) (match_dup 2)))]
9175 "TARGET_POWERPC64 && TARGET_UPDATE"
9176 "@
9177 ldux %3,%0,%2
9178 ldu %3,%2(%0)"
9179 [(set_attr "type" "load")])
9180
9181 (define_insn "*movdi_update2"
9182 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
9183 (sign_extend:DI
9184 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
9185 (match_operand:DI 2 "gpc_reg_operand" "r")))))
9186 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
9187 (plus:DI (match_dup 1) (match_dup 2)))]
9188 "TARGET_POWERPC64"
9189 "lwaux %3,%0,%2"
9190 [(set_attr "type" "load")])
9191
9192 (define_insn "movdi_update"
9193 [(set (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9194 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I")))
9195 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9196 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9197 (plus:DI (match_dup 1) (match_dup 2)))]
9198 "TARGET_POWERPC64 && TARGET_UPDATE"
9199 "@
9200 stdux %3,%0,%2
9201 stdu %3,%2(%0)"
9202 [(set_attr "type" "store")])
9203
9204 (define_insn "*movsi_update1"
9205 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9206 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9207 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9208 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9209 (plus:SI (match_dup 1) (match_dup 2)))]
9210 ""
9211 "@
9212 {lux|lwzux} %3,%0,%2
9213 {lu|lwzu} %3,%2(%0)"
9214 [(set_attr "type" "load")])
9215
9216 (define_insn "movsi_update"
9217 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9218 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9219 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9220 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9221 (plus:SI (match_dup 1) (match_dup 2)))]
9222 "TARGET_UPDATE"
9223 "@
9224 {stux|stwux} %3,%0,%2
9225 {stu|stwu} %3,%2(%0)"
9226 [(set_attr "type" "store")])
9227
9228 (define_insn "*movhi_update"
9229 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
9230 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9231 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9232 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9233 (plus:SI (match_dup 1) (match_dup 2)))]
9234 "TARGET_UPDATE"
9235 "@
9236 lhzux %3,%0,%2
9237 lhzu %3,%2(%0)"
9238 [(set_attr "type" "load")])
9239
9240 (define_insn "*movhi_update2"
9241 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9242 (zero_extend:SI
9243 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9244 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9245 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9246 (plus:SI (match_dup 1) (match_dup 2)))]
9247 "TARGET_UPDATE"
9248 "@
9249 lhzux %3,%0,%2
9250 lhzu %3,%2(%0)"
9251 [(set_attr "type" "load")])
9252
9253 (define_insn "*movhi_update3"
9254 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9255 (sign_extend:SI
9256 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9257 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9258 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9259 (plus:SI (match_dup 1) (match_dup 2)))]
9260 "TARGET_UPDATE"
9261 "@
9262 lhaux %3,%0,%2
9263 lhau %3,%2(%0)"
9264 [(set_attr "type" "load")])
9265
9266 (define_insn "*movhi_update4"
9267 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9268 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9269 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9270 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9271 (plus:SI (match_dup 1) (match_dup 2)))]
9272 "TARGET_UPDATE"
9273 "@
9274 sthux %3,%0,%2
9275 sthu %3,%2(%0)"
9276 [(set_attr "type" "store")])
9277
9278 (define_insn "*movqi_update1"
9279 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9280 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9281 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9282 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9283 (plus:SI (match_dup 1) (match_dup 2)))]
9284 "TARGET_UPDATE"
9285 "@
9286 lbzux %3,%0,%2
9287 lbzu %3,%2(%0)"
9288 [(set_attr "type" "load")])
9289
9290 (define_insn "*movqi_update2"
9291 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9292 (zero_extend:SI
9293 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9294 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9295 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9296 (plus:SI (match_dup 1) (match_dup 2)))]
9297 "TARGET_UPDATE"
9298 "@
9299 lbzux %3,%0,%2
9300 lbzu %3,%2(%0)"
9301 [(set_attr "type" "load")])
9302
9303 (define_insn "*movqi_update3"
9304 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9305 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9306 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
9307 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9308 (plus:SI (match_dup 1) (match_dup 2)))]
9309 "TARGET_UPDATE"
9310 "@
9311 stbux %3,%0,%2
9312 stbu %3,%2(%0)"
9313 [(set_attr "type" "store")])
9314
9315 (define_insn "*movsf_update1"
9316 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
9317 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9318 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9319 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9320 (plus:SI (match_dup 1) (match_dup 2)))]
9321 "TARGET_HARD_FLOAT && TARGET_UPDATE"
9322 "@
9323 lfsux %3,%0,%2
9324 lfsu %3,%2(%0)"
9325 [(set_attr "type" "fpload")])
9326
9327 (define_insn "*movsf_update2"
9328 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9329 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9330 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
9331 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9332 (plus:SI (match_dup 1) (match_dup 2)))]
9333 "TARGET_HARD_FLOAT && TARGET_UPDATE"
9334 "@
9335 stfsux %3,%0,%2
9336 stfsu %3,%2(%0)"
9337 [(set_attr "type" "fpstore")])
9338
9339 (define_insn "*movsf_update3"
9340 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
9341 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9342 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9343 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9344 (plus:SI (match_dup 1) (match_dup 2)))]
9345 "TARGET_SOFT_FLOAT && TARGET_UPDATE"
9346 "@
9347 {lux|lwzux} %3,%0,%2
9348 {lu|lwzu} %3,%2(%0)"
9349 [(set_attr "type" "load")])
9350
9351 (define_insn "*movsf_update4"
9352 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9353 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9354 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
9355 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9356 (plus:SI (match_dup 1) (match_dup 2)))]
9357 "TARGET_SOFT_FLOAT && TARGET_UPDATE"
9358 "@
9359 {stux|stwux} %3,%0,%2
9360 {stu|stwu} %3,%2(%0)"
9361 [(set_attr "type" "store")])
9362
9363 (define_insn "*movdf_update1"
9364 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
9365 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9366 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9367 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9368 (plus:SI (match_dup 1) (match_dup 2)))]
9369 "TARGET_HARD_FLOAT && TARGET_UPDATE"
9370 "@
9371 lfdux %3,%0,%2
9372 lfdu %3,%2(%0)"
9373 [(set_attr "type" "fpload")])
9374
9375 (define_insn "*movdf_update2"
9376 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9377 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9378 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
9379 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9380 (plus:SI (match_dup 1) (match_dup 2)))]
9381 "TARGET_HARD_FLOAT && TARGET_UPDATE"
9382 "@
9383 stfdux %3,%0,%2
9384 stfdu %3,%2(%0)"
9385 [(set_attr "type" "fpstore")])
9386
9387 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
9388
9389 (define_peephole
9390 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
9391 (match_operand:DF 1 "memory_operand" ""))
9392 (set (match_operand:DF 2 "gpc_reg_operand" "=f")
9393 (match_operand:DF 3 "memory_operand" ""))]
9394 "TARGET_POWER2
9395 && TARGET_HARD_FLOAT
9396 && registers_ok_for_quad_peep (operands[0], operands[2])
9397 && ! MEM_VOLATILE_P (operands[1]) && ! MEM_VOLATILE_P (operands[3])
9398 && addrs_ok_for_quad_peep (XEXP (operands[1], 0), XEXP (operands[3], 0))"
9399 "lfq%U1%X1 %0,%1")
9400
9401 (define_peephole
9402 [(set (match_operand:DF 0 "memory_operand" "")
9403 (match_operand:DF 1 "gpc_reg_operand" "f"))
9404 (set (match_operand:DF 2 "memory_operand" "")
9405 (match_operand:DF 3 "gpc_reg_operand" "f"))]
9406 "TARGET_POWER2
9407 && TARGET_HARD_FLOAT
9408 && registers_ok_for_quad_peep (operands[1], operands[3])
9409 && ! MEM_VOLATILE_P (operands[0]) && ! MEM_VOLATILE_P (operands[2])
9410 && addrs_ok_for_quad_peep (XEXP (operands[0], 0), XEXP (operands[2], 0))"
9411 "stfq%U0%X0 %1,%0")
9412 \f
9413 ;; Next come insns related to the calling sequence.
9414 ;;
9415 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
9416 ;; We move the back-chain and decrement the stack pointer.
9417
9418 (define_expand "allocate_stack"
9419 [(set (match_operand 0 "gpc_reg_operand" "=r")
9420 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
9421 (set (reg 1)
9422 (minus (reg 1) (match_dup 1)))]
9423 ""
9424 "
9425 { rtx chain = gen_reg_rtx (Pmode);
9426 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
9427 rtx neg_op0;
9428
9429 emit_move_insn (chain, stack_bot);
9430
9431 /* Check stack bounds if necessary. */
9432 if (current_function_limit_stack)
9433 {
9434 rtx available;
9435 available = expand_binop (Pmode, sub_optab,
9436 stack_pointer_rtx, stack_limit_rtx,
9437 NULL_RTX, 1, OPTAB_WIDEN);
9438 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
9439 }
9440
9441 if (GET_CODE (operands[1]) != CONST_INT
9442 || INTVAL (operands[1]) < -32767
9443 || INTVAL (operands[1]) > 32768)
9444 {
9445 neg_op0 = gen_reg_rtx (Pmode);
9446 if (TARGET_32BIT)
9447 emit_insn (gen_negsi2 (neg_op0, operands[1]));
9448 else
9449 emit_insn (gen_negdi2 (neg_op0, operands[1]));
9450 }
9451 else
9452 neg_op0 = GEN_INT (- INTVAL (operands[1]));
9453
9454 if (TARGET_UPDATE)
9455 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_update))
9456 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
9457
9458 else
9459 {
9460 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
9461 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
9462 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
9463 }
9464
9465 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
9466 DONE;
9467 }")
9468
9469 ;; These patterns say how to save and restore the stack pointer. We need not
9470 ;; save the stack pointer at function level since we are careful to
9471 ;; preserve the backchain. At block level, we have to restore the backchain
9472 ;; when we restore the stack pointer.
9473 ;;
9474 ;; For nonlocal gotos, we must save both the stack pointer and its
9475 ;; backchain and restore both. Note that in the nonlocal case, the
9476 ;; save area is a memory location.
9477
9478 (define_expand "save_stack_function"
9479 [(match_operand 0 "any_operand" "")
9480 (match_operand 1 "any_operand" "")]
9481 ""
9482 "DONE;")
9483
9484 (define_expand "restore_stack_function"
9485 [(match_operand 0 "any_operand" "")
9486 (match_operand 1 "any_operand" "")]
9487 ""
9488 "DONE;")
9489
9490 (define_expand "restore_stack_block"
9491 [(use (match_operand 0 "register_operand" ""))
9492 (set (match_dup 2) (match_dup 3))
9493 (set (match_dup 0) (match_operand 1 "register_operand" ""))
9494 (set (match_dup 3) (match_dup 2))]
9495 ""
9496 "
9497 {
9498 operands[2] = gen_reg_rtx (Pmode);
9499 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
9500 }")
9501
9502 (define_expand "save_stack_nonlocal"
9503 [(match_operand 0 "memory_operand" "")
9504 (match_operand 1 "register_operand" "")]
9505 ""
9506 "
9507 {
9508 rtx temp = gen_reg_rtx (Pmode);
9509
9510 /* Copy the backchain to the first word, sp to the second. */
9511 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
9512 emit_move_insn (operand_subword (operands[0], 0, 0,
9513 (TARGET_32BIT ? DImode : TImode)),
9514 temp);
9515 emit_move_insn (operand_subword (operands[0], 1, 0, (TARGET_32BIT ? DImode : TImode)),
9516 operands[1]);
9517 DONE;
9518 }")
9519
9520 (define_expand "restore_stack_nonlocal"
9521 [(match_operand 0 "register_operand" "")
9522 (match_operand 1 "memory_operand" "")]
9523 ""
9524 "
9525 {
9526 rtx temp = gen_reg_rtx (Pmode);
9527
9528 /* Restore the backchain from the first word, sp from the second. */
9529 emit_move_insn (temp,
9530 operand_subword (operands[1], 0, 0, (TARGET_32BIT ? DImode : TImode)));
9531 emit_move_insn (operands[0],
9532 operand_subword (operands[1], 1, 0,
9533 (TARGET_32BIT ? DImode : TImode)));
9534 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
9535 DONE;
9536 }")
9537 \f
9538 ;; TOC register handling.
9539
9540 ;; Code to initialize the TOC register...
9541
9542 (define_insn "load_toc_aix_si"
9543 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9544 (unspec:SI [(const_int 0)] 7))
9545 (use (reg:SI 2))])]
9546 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
9547 "*
9548 {
9549 char buf[30];
9550 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
9551 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
9552 operands[2] = gen_rtx_REG (Pmode, 2);
9553 return \"{l|lwz} %0,%1(%2)\";
9554 }"
9555 [(set_attr "type" "load")])
9556
9557 (define_insn "load_toc_aix_di"
9558 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9559 (unspec:DI [(const_int 0)] 7))
9560 (use (reg:DI 2))])]
9561 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
9562 "*
9563 {
9564 char buf[30];
9565 #ifdef TARGET_RELOCATABLE
9566 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
9567 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
9568 #else
9569 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
9570 #endif
9571 if (TARGET_ELF)
9572 strcat (buf, \"@toc\");
9573 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
9574 operands[2] = gen_rtx_REG (Pmode, 2);
9575 return \"ld %0,%1(%2)\";
9576 }"
9577 [(set_attr "type" "load")])
9578
9579 (define_insn "load_toc_v4_pic_si"
9580 [(set (match_operand:SI 0 "register_operand" "=l")
9581 (unspec:SI [(const_int 0)] 7))]
9582 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
9583 "bl _GLOBAL_OFFSET_TABLE_@local-4"
9584 [(set_attr "type" "branch")
9585 (set_attr "length" "4")])
9586
9587 (define_insn "load_toc_v4_PIC_1"
9588 [(set (match_operand:SI 0 "register_operand" "=l")
9589 (match_operand:SI 1 "immediate_operand" "s"))
9590 (unspec [(match_dup 1)] 7)]
9591 "TARGET_ELF && flag_pic == 2"
9592 "bl %1\\n%1:"
9593 [(set_attr "type" "branch")
9594 (set_attr "length" "4")])
9595
9596 (define_insn "load_toc_v4_PIC_1b"
9597 [(set (match_operand:SI 0 "register_operand" "=l")
9598 (match_operand:SI 1 "immediate_operand" "s"))
9599 (unspec [(match_dup 1) (match_operand 2 "immediate_operand" "s")] 6)]
9600 "TARGET_ELF && flag_pic == 2"
9601 "bl %1\\n\\t.long %2-%1+4\\n%1:"
9602 [(set_attr "type" "branch")
9603 (set_attr "length" "8")])
9604
9605 (define_insn "load_toc_v4_PIC_2"
9606 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9607 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9608 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
9609 (match_operand:SI 3 "immediate_operand" "s")))))]
9610 "TARGET_ELF && flag_pic == 2"
9611 "{l|lwz} %0,%2-%3(%1)"
9612 [(set_attr "type" "load")])
9613
9614 (define_insn "load_macho_picbase"
9615 [(set (match_operand:SI 0 "register_operand" "=l")
9616 (unspec:SI [(const_int 0)] 15))]
9617 "(DEFAULT_ABI == ABI_DARWIN) && flag_pic"
9618 "*
9619 {
9620 #if TARGET_MACHO
9621 char *picbase = machopic_function_base_name ();
9622 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_alloc_string (picbase, -1));
9623 #endif
9624 return \"bcl 20,31,%1\\n%1:\";
9625 }"
9626 [(set_attr "type" "branch")
9627 (set_attr "length" "4")])
9628
9629 ;; If the TOC is shared over a translation unit, as happens with all
9630 ;; the kinds of PIC that we support, we need to restore the TOC
9631 ;; pointer only when jumping over units of translation.
9632
9633 (define_expand "builtin_setjmp_receiver"
9634 [(use (label_ref (match_operand 0 "" "")))]
9635 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
9636 || (TARGET_TOC && TARGET_MINIMAL_TOC)"
9637 "
9638 {
9639 rs6000_emit_load_toc_table (FALSE);
9640 DONE;
9641 }")
9642 \f
9643 ;; A function pointer under AIX is a pointer to a data area whose first word
9644 ;; contains the actual address of the function, whose second word contains a
9645 ;; pointer to its TOC, and whose third word contains a value to place in the
9646 ;; static chain register (r11). Note that if we load the static chain, our
9647 ;; "trampoline" need not have any executable code.
9648
9649 (define_expand "call_indirect_aix32"
9650 [(set (match_dup 2)
9651 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
9652 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
9653 (reg:SI 2))
9654 (set (reg:SI 2)
9655 (mem:SI (plus:SI (match_dup 0)
9656 (const_int 4))))
9657 (set (reg:SI 11)
9658 (mem:SI (plus:SI (match_dup 0)
9659 (const_int 8))))
9660 (parallel [(call (mem:SI (match_dup 2))
9661 (match_operand 1 "" ""))
9662 (use (reg:SI 2))
9663 (use (reg:SI 11))
9664 (set (reg:SI 2)
9665 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
9666 (clobber (scratch:SI))])]
9667 "TARGET_32BIT"
9668 "
9669 { operands[2] = gen_reg_rtx (SImode); }")
9670
9671 (define_expand "call_indirect_aix64"
9672 [(set (match_dup 2)
9673 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
9674 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
9675 (reg:DI 2))
9676 (set (reg:DI 2)
9677 (mem:DI (plus:DI (match_dup 0)
9678 (const_int 8))))
9679 (set (reg:DI 11)
9680 (mem:DI (plus:DI (match_dup 0)
9681 (const_int 16))))
9682 (parallel [(call (mem:SI (match_dup 2))
9683 (match_operand 1 "" ""))
9684 (use (reg:DI 2))
9685 (use (reg:DI 11))
9686 (set (reg:DI 2)
9687 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
9688 (clobber (scratch:SI))])]
9689 "TARGET_64BIT"
9690 "
9691 { operands[2] = gen_reg_rtx (DImode); }")
9692
9693 (define_expand "call_value_indirect_aix32"
9694 [(set (match_dup 3)
9695 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
9696 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
9697 (reg:SI 2))
9698 (set (reg:SI 2)
9699 (mem:SI (plus:SI (match_dup 1)
9700 (const_int 4))))
9701 (set (reg:SI 11)
9702 (mem:SI (plus:SI (match_dup 1)
9703 (const_int 8))))
9704 (parallel [(set (match_operand 0 "" "")
9705 (call (mem:SI (match_dup 3))
9706 (match_operand 2 "" "")))
9707 (use (reg:SI 2))
9708 (use (reg:SI 11))
9709 (set (reg:SI 2)
9710 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
9711 (clobber (scratch:SI))])]
9712 "TARGET_32BIT"
9713 "
9714 { operands[3] = gen_reg_rtx (SImode); }")
9715
9716 (define_expand "call_value_indirect_aix64"
9717 [(set (match_dup 3)
9718 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
9719 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
9720 (reg:DI 2))
9721 (set (reg:DI 2)
9722 (mem:DI (plus:DI (match_dup 1)
9723 (const_int 8))))
9724 (set (reg:DI 11)
9725 (mem:DI (plus:DI (match_dup 1)
9726 (const_int 16))))
9727 (parallel [(set (match_operand 0 "" "")
9728 (call (mem:SI (match_dup 3))
9729 (match_operand 2 "" "")))
9730 (use (reg:DI 2))
9731 (use (reg:DI 11))
9732 (set (reg:DI 2)
9733 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
9734 (clobber (scratch:SI))])]
9735 "TARGET_64BIT"
9736 "
9737 { operands[3] = gen_reg_rtx (DImode); }")
9738
9739 ;; Now the definitions for the call and call_value insns
9740 (define_expand "call"
9741 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
9742 (match_operand 1 "" ""))
9743 (use (match_operand 2 "" ""))
9744 (clobber (scratch:SI))])]
9745 ""
9746 "
9747 {
9748 #if TARGET_MACHO
9749 if (flag_pic)
9750 operands[0] = machopic_indirect_call_target (operands[0]);
9751 #endif
9752
9753 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
9754 abort ();
9755
9756 operands[0] = XEXP (operands[0], 0);
9757
9758 if (GET_CODE (operands[0]) != SYMBOL_REF
9759 || (INTVAL (operands[2]) & CALL_LONG) != 0)
9760 {
9761 if (INTVAL (operands[2]) & CALL_LONG)
9762 operands[0] = rs6000_longcall_ref (operands[0]);
9763
9764 if (DEFAULT_ABI == ABI_V4
9765 || DEFAULT_ABI == ABI_AIX_NODESC
9766 || DEFAULT_ABI == ABI_DARWIN)
9767 operands[0] = force_reg (Pmode, operands[0]);
9768
9769 else if (DEFAULT_ABI == ABI_AIX)
9770 {
9771 /* AIX function pointers are really pointers to a three word
9772 area. */
9773 emit_call_insn (TARGET_32BIT
9774 ? gen_call_indirect_aix32 (force_reg (SImode,
9775 operands[0]),
9776 operands[1])
9777 : gen_call_indirect_aix64 (force_reg (DImode,
9778 operands[0]),
9779 operands[1]));
9780 DONE;
9781 }
9782 else
9783 abort ();
9784 }
9785 }")
9786
9787 (define_expand "call_value"
9788 [(parallel [(set (match_operand 0 "" "")
9789 (call (mem:SI (match_operand 1 "address_operand" ""))
9790 (match_operand 2 "" "")))
9791 (use (match_operand 3 "" ""))
9792 (clobber (scratch:SI))])]
9793 ""
9794 "
9795 {
9796 #if TARGET_MACHO
9797 if (flag_pic)
9798 operands[1] = machopic_indirect_call_target (operands[1]);
9799 #endif
9800
9801 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
9802 abort ();
9803
9804 operands[1] = XEXP (operands[1], 0);
9805
9806 if (GET_CODE (operands[1]) != SYMBOL_REF
9807 || (INTVAL (operands[3]) & CALL_LONG) != 0)
9808 {
9809 if (INTVAL (operands[3]) & CALL_LONG)
9810 operands[1] = rs6000_longcall_ref (operands[1]);
9811
9812 if (DEFAULT_ABI == ABI_V4
9813 || DEFAULT_ABI == ABI_AIX_NODESC
9814 || DEFAULT_ABI == ABI_DARWIN)
9815 operands[0] = force_reg (Pmode, operands[0]);
9816
9817 else if (DEFAULT_ABI == ABI_AIX)
9818 {
9819 /* AIX function pointers are really pointers to a three word
9820 area. */
9821 emit_call_insn (TARGET_32BIT
9822 ? gen_call_value_indirect_aix32 (operands[0],
9823 force_reg (SImode,
9824 operands[1]),
9825 operands[2])
9826 : gen_call_value_indirect_aix64 (operands[0],
9827 force_reg (DImode,
9828 operands[1]),
9829 operands[2]));
9830 DONE;
9831 }
9832 else
9833 abort ();
9834 }
9835 }")
9836
9837 ;; Call to function in current module. No TOC pointer reload needed.
9838 ;; Operand2 is non-zero if we are using the V.4 calling sequence and
9839 ;; either the function was not prototyped, or it was prototyped as a
9840 ;; variable argument function. It is > 0 if FP registers were passed
9841 ;; and < 0 if they were not.
9842
9843 (define_insn "*call_local32"
9844 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
9845 (match_operand 1 "" "g,g"))
9846 (use (match_operand:SI 2 "immediate_operand" "O,n"))
9847 (clobber (match_scratch:SI 3 "=l,l"))]
9848 "(INTVAL (operands[2]) & CALL_LONG) == 0"
9849 "*
9850 {
9851 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
9852 output_asm_insn (\"crxor 6,6,6\", operands);
9853
9854 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
9855 output_asm_insn (\"creqv 6,6,6\", operands);
9856
9857 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
9858 }"
9859 [(set_attr "type" "branch")
9860 (set_attr "length" "4,8")])
9861
9862 (define_insn "*call_local64"
9863 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
9864 (match_operand 1 "" "g,g"))
9865 (use (match_operand:SI 2 "immediate_operand" "O,n"))
9866 (clobber (match_scratch:SI 3 "=l,l"))]
9867 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
9868 "*
9869 {
9870 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
9871 output_asm_insn (\"crxor 6,6,6\", operands);
9872
9873 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
9874 output_asm_insn (\"creqv 6,6,6\", operands);
9875
9876 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
9877 }"
9878 [(set_attr "type" "branch")
9879 (set_attr "length" "4,8")])
9880
9881 (define_insn "*call_value_local32"
9882 [(set (match_operand 0 "" "")
9883 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
9884 (match_operand 2 "" "g,g")))
9885 (use (match_operand:SI 3 "immediate_operand" "O,n"))
9886 (clobber (match_scratch:SI 4 "=l,l"))]
9887 "(INTVAL (operands[3]) & CALL_LONG) == 0"
9888 "*
9889 {
9890 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
9891 output_asm_insn (\"crxor 6,6,6\", operands);
9892
9893 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
9894 output_asm_insn (\"creqv 6,6,6\", operands);
9895
9896 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
9897 }"
9898 [(set_attr "type" "branch")
9899 (set_attr "length" "4,8")])
9900
9901
9902 (define_insn "*call_value_local64"
9903 [(set (match_operand 0 "" "")
9904 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
9905 (match_operand 2 "" "g,g")))
9906 (use (match_operand:SI 3 "immediate_operand" "O,n"))
9907 (clobber (match_scratch:SI 4 "=l,l"))]
9908 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
9909 "*
9910 {
9911 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
9912 output_asm_insn (\"crxor 6,6,6\", operands);
9913
9914 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
9915 output_asm_insn (\"creqv 6,6,6\", operands);
9916
9917 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
9918 }"
9919 [(set_attr "type" "branch")
9920 (set_attr "length" "4,8")])
9921
9922 ;; Call to function which may be in another module. Restore the TOC
9923 ;; pointer (r2) after the call unless this is System V.
9924 ;; Operand2 is non-zero if we are using the V.4 calling sequence and
9925 ;; either the function was not prototyped, or it was prototyped as a
9926 ;; variable argument function. It is > 0 if FP registers were passed
9927 ;; and < 0 if they were not.
9928
9929 (define_insn "*call_indirect_nonlocal_aix32"
9930 [(call (mem:SI (match_operand:SI 0 "register_operand" "cl"))
9931 (match_operand 1 "" "g"))
9932 (use (reg:SI 2))
9933 (use (reg:SI 11))
9934 (set (reg:SI 2)
9935 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
9936 (clobber (match_scratch:SI 2 "=l"))]
9937 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
9938 "b%T0l\;{l|lwz} 2,20(1)"
9939 [(set_attr "type" "jmpreg")
9940 (set_attr "length" "8")])
9941
9942 (define_insn "*call_nonlocal_aix32"
9943 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
9944 (match_operand 1 "" "g"))
9945 (use (match_operand:SI 2 "immediate_operand" "O"))
9946 (clobber (match_scratch:SI 3 "=l"))]
9947 "TARGET_32BIT
9948 && DEFAULT_ABI == ABI_AIX
9949 && (INTVAL (operands[2]) & CALL_LONG) == 0"
9950 "bl %z0\;%."
9951 [(set_attr "type" "branch")
9952 (set_attr "length" "8")])
9953
9954 (define_insn "*call_indirect_nonlocal_aix64"
9955 [(call (mem:SI (match_operand:DI 0 "register_operand" "cl"))
9956 (match_operand 1 "" "g"))
9957 (use (reg:DI 2))
9958 (use (reg:DI 11))
9959 (set (reg:DI 2)
9960 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
9961 (clobber (match_scratch:SI 2 "=l"))]
9962 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
9963 "b%T0l\;ld 2,40(1)"
9964 [(set_attr "type" "jmpreg")
9965 (set_attr "length" "8")])
9966
9967 (define_insn "*call_nonlocal_aix64"
9968 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
9969 (match_operand 1 "" "g"))
9970 (use (match_operand:SI 2 "immediate_operand" "O"))
9971 (clobber (match_scratch:SI 3 "=l"))]
9972 "TARGET_64BIT
9973 && DEFAULT_ABI == ABI_AIX
9974 && (INTVAL (operands[2]) & CALL_LONG) == 0"
9975 "bl %z0\;%."
9976 [(set_attr "type" "branch")
9977 (set_attr "length" "8")])
9978
9979 (define_insn "*call_value_indirect_nonlocal_aix32"
9980 [(set (match_operand 0 "" "")
9981 (call (mem:SI (match_operand:SI 1 "register_operand" "cl"))
9982 (match_operand 2 "" "g")))
9983 (use (reg:SI 2))
9984 (use (reg:SI 11))
9985 (set (reg:SI 2)
9986 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
9987 (clobber (match_scratch:SI 3 "=l"))]
9988 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
9989 "b%T1l\;{l|lwz} 2,20(1)"
9990 [(set_attr "type" "jmpreg")
9991 (set_attr "length" "8")])
9992
9993 (define_insn "*call_value_nonlocal_aix32"
9994 [(set (match_operand 0 "" "")
9995 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
9996 (match_operand 2 "" "g")))
9997 (use (match_operand:SI 3 "immediate_operand" "O"))
9998 (clobber (match_scratch:SI 4 "=l"))]
9999 "TARGET_32BIT
10000 && DEFAULT_ABI == ABI_AIX
10001 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10002 "bl %z1\;%."
10003 [(set_attr "type" "branch")
10004 (set_attr "length" "8")])
10005
10006 (define_insn "*call_value_indirect_nonlocal_aix64"
10007 [(set (match_operand 0 "" "")
10008 (call (mem:SI (match_operand:DI 1 "register_operand" "cl"))
10009 (match_operand 2 "" "g")))
10010 (use (reg:DI 2))
10011 (use (reg:DI 11))
10012 (set (reg:DI 2)
10013 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10014 (clobber (match_scratch:SI 3 "=l"))]
10015 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10016 "b%T1l\;ld 2,40(1)"
10017 [(set_attr "type" "jmpreg")
10018 (set_attr "length" "8")])
10019
10020 (define_insn "*call_value_nonlocal_aix64"
10021 [(set (match_operand 0 "" "")
10022 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10023 (match_operand 2 "" "g")))
10024 (use (match_operand:SI 3 "immediate_operand" "O"))
10025 (clobber (match_scratch:SI 4 "=l"))]
10026 "TARGET_64BIT
10027 && DEFAULT_ABI == ABI_AIX
10028 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10029 "bl %z1\;%."
10030 [(set_attr "type" "branch")
10031 (set_attr "length" "8")])
10032
10033 ;; A function pointer under System V is just a normal pointer
10034 ;; operands[0] is the function pointer
10035 ;; operands[1] is the stack size to clean up
10036 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
10037 ;; which indicates how to set cr1
10038
10039 (define_insn "*call_nonlocal_sysv"
10040 [(call (mem:SI (match_operand:SI 0 "call_operand" "cl,cl,s,s"))
10041 (match_operand 1 "" "g,g,g,g"))
10042 (use (match_operand:SI 2 "immediate_operand" "O,n,O,n"))
10043 (clobber (match_scratch:SI 3 "=l,l,l,l"))]
10044 "DEFAULT_ABI == ABI_AIX_NODESC
10045 || DEFAULT_ABI == ABI_V4
10046 || DEFAULT_ABI == ABI_DARWIN"
10047 "*
10048 {
10049 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10050 output_asm_insn (\"crxor 6,6,6\", operands);
10051
10052 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10053 output_asm_insn (\"creqv 6,6,6\", operands);
10054
10055 switch (which_alternative)
10056 {
10057 default:
10058 abort ();
10059 case 0:
10060 case 1:
10061 return \"b%T0l\";
10062 case 2:
10063 case 3:
10064 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@plt\" : \"bl %z0\";
10065 }
10066 }"
10067 [(set_attr "type" "jmpreg,jmpreg,branch,branch")
10068 (set_attr "length" "4,8,4,8")])
10069
10070 (define_insn "*call_value_nonlocal_sysv"
10071 [(set (match_operand 0 "" "")
10072 (call (mem:SI (match_operand:SI 1 "call_operand" "cl,cl,s,s"))
10073 (match_operand 2 "" "g,g,g,g")))
10074 (use (match_operand:SI 3 "immediate_operand" "O,n,O,n"))
10075 (clobber (match_scratch:SI 4 "=l,l,l,l"))]
10076 "DEFAULT_ABI == ABI_AIX_NODESC
10077 || DEFAULT_ABI == ABI_V4
10078 || DEFAULT_ABI == ABI_DARWIN"
10079 "*
10080 {
10081 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10082 output_asm_insn (\"crxor 6,6,6\", operands);
10083
10084 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10085 output_asm_insn (\"creqv 6,6,6\", operands);
10086
10087 switch (which_alternative)
10088 {
10089 default:
10090 abort ();
10091 case 0:
10092 case 1:
10093 return \"b%T1l\";
10094 case 2:
10095 case 3:
10096 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@plt\" : \"bl %z1\";
10097 }
10098 }"
10099 [(set_attr "type" "jmpreg,jmpreg,branch,branch")
10100 (set_attr "length" "4,8,4,8")])
10101
10102 ;; Call subroutine returning any type.
10103 (define_expand "untyped_call"
10104 [(parallel [(call (match_operand 0 "" "")
10105 (const_int 0))
10106 (match_operand 1 "" "")
10107 (match_operand 2 "" "")])]
10108 ""
10109 "
10110 {
10111 int i;
10112
10113 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
10114
10115 for (i = 0; i < XVECLEN (operands[2], 0); i++)
10116 {
10117 rtx set = XVECEXP (operands[2], 0, i);
10118 emit_move_insn (SET_DEST (set), SET_SRC (set));
10119 }
10120
10121 /* The optimizer does not know that the call sets the function value
10122 registers we stored in the result block. We avoid problems by
10123 claiming that all hard registers are used and clobbered at this
10124 point. */
10125 emit_insn (gen_blockage ());
10126
10127 DONE;
10128 }")
10129
10130 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
10131 ;; all of memory. This blocks insns from being moved across this point.
10132
10133 (define_insn "blockage"
10134 [(unspec_volatile [(const_int 0)] 0)]
10135 ""
10136 "")
10137 \f
10138 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
10139 ;; signed & unsigned, and one type of branch.
10140 ;;
10141 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
10142 ;; insns, and branches. We store the operands of compares until we see
10143 ;; how it is used.
10144 (define_expand "cmpsi"
10145 [(set (cc0)
10146 (compare (match_operand:SI 0 "gpc_reg_operand" "")
10147 (match_operand:SI 1 "reg_or_short_operand" "")))]
10148 ""
10149 "
10150 {
10151 /* Take care of the possibility that operands[1] might be negative but
10152 this might be a logical operation. That insn doesn't exist. */
10153 if (GET_CODE (operands[1]) == CONST_INT
10154 && INTVAL (operands[1]) < 0)
10155 operands[1] = force_reg (SImode, operands[1]);
10156
10157 rs6000_compare_op0 = operands[0];
10158 rs6000_compare_op1 = operands[1];
10159 rs6000_compare_fp_p = 0;
10160 DONE;
10161 }")
10162
10163 (define_expand "cmpdi"
10164 [(set (cc0)
10165 (compare (match_operand:DI 0 "gpc_reg_operand" "")
10166 (match_operand:DI 1 "reg_or_short_operand" "")))]
10167 "TARGET_POWERPC64"
10168 "
10169 {
10170 /* Take care of the possibility that operands[1] might be negative but
10171 this might be a logical operation. That insn doesn't exist. */
10172 if (GET_CODE (operands[1]) == CONST_INT
10173 && INTVAL (operands[1]) < 0)
10174 operands[1] = force_reg (DImode, operands[1]);
10175
10176 rs6000_compare_op0 = operands[0];
10177 rs6000_compare_op1 = operands[1];
10178 rs6000_compare_fp_p = 0;
10179 DONE;
10180 }")
10181
10182 (define_expand "cmpsf"
10183 [(set (cc0) (compare (match_operand:SF 0 "gpc_reg_operand" "")
10184 (match_operand:SF 1 "gpc_reg_operand" "")))]
10185 "TARGET_HARD_FLOAT"
10186 "
10187 {
10188 rs6000_compare_op0 = operands[0];
10189 rs6000_compare_op1 = operands[1];
10190 rs6000_compare_fp_p = 1;
10191 DONE;
10192 }")
10193
10194 (define_expand "cmpdf"
10195 [(set (cc0) (compare (match_operand:DF 0 "gpc_reg_operand" "")
10196 (match_operand:DF 1 "gpc_reg_operand" "")))]
10197 "TARGET_HARD_FLOAT"
10198 "
10199 {
10200 rs6000_compare_op0 = operands[0];
10201 rs6000_compare_op1 = operands[1];
10202 rs6000_compare_fp_p = 1;
10203 DONE;
10204 }")
10205
10206 (define_expand "cmptf"
10207 [(set (cc0) (compare (match_operand:TF 0 "gpc_reg_operand" "")
10208 (match_operand:TF 1 "gpc_reg_operand" "")))]
10209 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_LONG_DOUBLE_128"
10210 "
10211 {
10212 rs6000_compare_op0 = operands[0];
10213 rs6000_compare_op1 = operands[1];
10214 rs6000_compare_fp_p = 1;
10215 DONE;
10216 }")
10217
10218 (define_expand "beq"
10219 [(use (match_operand 0 "" ""))]
10220 ""
10221 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
10222
10223 (define_expand "bne"
10224 [(use (match_operand 0 "" ""))]
10225 ""
10226 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
10227
10228 (define_expand "bge"
10229 [(use (match_operand 0 "" ""))]
10230 ""
10231 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
10232
10233 (define_expand "bgt"
10234 [(use (match_operand 0 "" ""))]
10235 ""
10236 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
10237
10238 (define_expand "ble"
10239 [(use (match_operand 0 "" ""))]
10240 ""
10241 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
10242
10243 (define_expand "blt"
10244 [(use (match_operand 0 "" ""))]
10245 ""
10246 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
10247
10248 (define_expand "bgeu"
10249 [(use (match_operand 0 "" ""))]
10250 ""
10251 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
10252
10253 (define_expand "bgtu"
10254 [(use (match_operand 0 "" ""))]
10255 ""
10256 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
10257
10258 (define_expand "bleu"
10259 [(use (match_operand 0 "" ""))]
10260 ""
10261 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
10262
10263 (define_expand "bltu"
10264 [(use (match_operand 0 "" ""))]
10265 ""
10266 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
10267
10268 (define_expand "bunordered"
10269 [(use (match_operand 0 "" ""))]
10270 ""
10271 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
10272
10273 (define_expand "bordered"
10274 [(use (match_operand 0 "" ""))]
10275 ""
10276 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
10277
10278 (define_expand "buneq"
10279 [(use (match_operand 0 "" ""))]
10280 ""
10281 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
10282
10283 (define_expand "bunge"
10284 [(use (match_operand 0 "" ""))]
10285 ""
10286 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
10287
10288 (define_expand "bungt"
10289 [(use (match_operand 0 "" ""))]
10290 ""
10291 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
10292
10293 (define_expand "bunle"
10294 [(use (match_operand 0 "" ""))]
10295 ""
10296 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
10297
10298 (define_expand "bunlt"
10299 [(use (match_operand 0 "" ""))]
10300 ""
10301 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
10302
10303 (define_expand "bltgt"
10304 [(use (match_operand 0 "" ""))]
10305 ""
10306 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
10307
10308 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
10309 ;; For SEQ, likewise, except that comparisons with zero should be done
10310 ;; with an scc insns. However, due to the order that combine see the
10311 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
10312 ;; the cases we don't want to handle.
10313 (define_expand "seq"
10314 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10315 ""
10316 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
10317
10318 (define_expand "sne"
10319 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10320 ""
10321 "
10322 {
10323 if (! rs6000_compare_fp_p)
10324 FAIL;
10325
10326 rs6000_emit_sCOND (NE, operands[0]);
10327 DONE;
10328 }")
10329
10330 ;; A > 0 is best done using the portable sequence, so fail in that case.
10331 (define_expand "sgt"
10332 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10333 ""
10334 "
10335 {
10336 if (! rs6000_compare_fp_p
10337 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
10338 FAIL;
10339
10340 rs6000_emit_sCOND (GT, operands[0]);
10341 DONE;
10342 }")
10343
10344 ;; A < 0 is best done in the portable way for A an integer.
10345 (define_expand "slt"
10346 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10347 ""
10348 "
10349 {
10350 if (! rs6000_compare_fp_p
10351 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
10352 FAIL;
10353
10354 rs6000_emit_sCOND (LT, operands[0]);
10355 DONE;
10356 }")
10357
10358 ;; A >= 0 is best done the portable way for A an integer.
10359 (define_expand "sge"
10360 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10361 ""
10362 "
10363 {
10364 if (! rs6000_compare_fp_p
10365 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
10366 FAIL;
10367
10368 rs6000_emit_sCOND (GE, operands[0]);
10369 DONE;
10370 }")
10371
10372 ;; A <= 0 is best done the portable way for A an integer.
10373 (define_expand "sle"
10374 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10375 ""
10376 "
10377 {
10378 if (! rs6000_compare_fp_p
10379 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
10380 FAIL;
10381
10382 rs6000_emit_sCOND (LE, operands[0]);
10383 DONE;
10384 }")
10385
10386 (define_expand "sgtu"
10387 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10388 ""
10389 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
10390
10391 (define_expand "sltu"
10392 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10393 ""
10394 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
10395
10396 (define_expand "sgeu"
10397 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10398 ""
10399 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
10400
10401 (define_expand "sleu"
10402 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10403 ""
10404 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
10405 \f
10406 ;; Here are the actual compare insns.
10407 (define_insn "*cmpsi_internal1"
10408 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
10409 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
10410 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
10411 ""
10412 "{cmp%I2|cmpw%I2} %0,%1,%2"
10413 [(set_attr "type" "compare")])
10414
10415 (define_insn "*cmpdi_internal1"
10416 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
10417 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r")
10418 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
10419 "TARGET_POWERPC64"
10420 "cmpd%I2 %0,%1,%2"
10421 [(set_attr "type" "compare")])
10422
10423 ;; If we are comparing a register for equality with a large constant,
10424 ;; we can do this with an XOR followed by a compare. But we need a scratch
10425 ;; register for the result of the XOR.
10426
10427 (define_split
10428 [(set (match_operand:CC 0 "cc_reg_operand" "")
10429 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
10430 (match_operand:SI 2 "non_short_cint_operand" "")))
10431 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
10432 "find_single_use (operands[0], insn, 0)
10433 && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
10434 || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
10435 [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
10436 (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
10437 "
10438 {
10439 /* Get the constant we are comparing against, C, and see what it looks like
10440 sign-extended to 16 bits. Then see what constant could be XOR'ed
10441 with C to get the sign-extended value. */
10442
10443 HOST_WIDE_INT c = INTVAL (operands[2]);
10444 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
10445 HOST_WIDE_INT xorv = c ^ sextc;
10446
10447 operands[4] = GEN_INT (xorv);
10448 operands[5] = GEN_INT (sextc);
10449 }")
10450
10451 (define_insn "*cmpsi_internal2"
10452 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
10453 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
10454 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
10455 ""
10456 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
10457 [(set_attr "type" "compare")])
10458
10459 (define_insn "*cmpdi_internal2"
10460 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
10461 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
10462 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
10463 ""
10464 "cmpld%I2 %0,%1,%b2"
10465 [(set_attr "type" "compare")])
10466
10467 ;; The following two insns don't exist as single insns, but if we provide
10468 ;; them, we can swap an add and compare, which will enable us to overlap more
10469 ;; of the required delay between a compare and branch. We generate code for
10470 ;; them by splitting.
10471
10472 (define_insn ""
10473 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
10474 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
10475 (match_operand:SI 2 "short_cint_operand" "i")))
10476 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
10477 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
10478 ""
10479 "#"
10480 [(set_attr "length" "8")])
10481
10482 (define_insn ""
10483 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
10484 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
10485 (match_operand:SI 2 "u_short_cint_operand" "i")))
10486 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
10487 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
10488 ""
10489 "#"
10490 [(set_attr "length" "8")])
10491
10492 (define_split
10493 [(set (match_operand:CC 3 "cc_reg_operand" "")
10494 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
10495 (match_operand:SI 2 "short_cint_operand" "")))
10496 (set (match_operand:SI 0 "gpc_reg_operand" "")
10497 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
10498 ""
10499 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
10500 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
10501
10502 (define_split
10503 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
10504 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
10505 (match_operand:SI 2 "u_short_cint_operand" "")))
10506 (set (match_operand:SI 0 "gpc_reg_operand" "")
10507 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
10508 ""
10509 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
10510 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
10511
10512 (define_insn "*cmpsf_internal1"
10513 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
10514 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
10515 (match_operand:SF 2 "gpc_reg_operand" "f")))]
10516 "TARGET_HARD_FLOAT"
10517 "fcmpu %0,%1,%2"
10518 [(set_attr "type" "fpcompare")])
10519
10520 (define_insn "*cmpdf_internal1"
10521 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
10522 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
10523 (match_operand:DF 2 "gpc_reg_operand" "f")))]
10524 "TARGET_HARD_FLOAT"
10525 "fcmpu %0,%1,%2"
10526 [(set_attr "type" "fpcompare")])
10527
10528 ;; Only need to compare second words if first words equal
10529 (define_insn "*cmptf_internal1"
10530 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
10531 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
10532 (match_operand:TF 2 "gpc_reg_operand" "f")))]
10533 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_LONG_DOUBLE_128"
10534 "fcmpu %0,%1,%2\;bne %0,$+4\;fcmpu %0,%L1,%L2"
10535 [(set_attr "type" "fpcompare")
10536 (set_attr "length" "12")])
10537 \f
10538 ;; Now we have the scc insns. We can do some combinations because of the
10539 ;; way the machine works.
10540 ;;
10541 ;; Note that this is probably faster if we can put an insn between the
10542 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
10543 ;; cases the insns below which don't use an intermediate CR field will
10544 ;; be used instead.
10545 (define_insn ""
10546 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10547 (match_operator:SI 1 "scc_comparison_operator"
10548 [(match_operand 2 "cc_reg_operand" "y")
10549 (const_int 0)]))]
10550 ""
10551 "%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%J1,1"
10552 [(set_attr "length" "12")])
10553
10554 (define_insn ""
10555 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10556 (match_operator:DI 1 "scc_comparison_operator"
10557 [(match_operand 2 "cc_reg_operand" "y")
10558 (const_int 0)]))]
10559 "TARGET_POWERPC64"
10560 "%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%J1,1"
10561 [(set_attr "length" "12")])
10562
10563 (define_insn ""
10564 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
10565 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
10566 [(match_operand 2 "cc_reg_operand" "y,y")
10567 (const_int 0)])
10568 (const_int 0)))
10569 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10570 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
10571 "! TARGET_POWERPC64"
10572 "@
10573 %D1mfcr %3\;{rlinm.|rlwinm.} %3,%3,%J1,1
10574 #"
10575 [(set_attr "type" "delayed_compare")
10576 (set_attr "length" "12,16")])
10577
10578 (define_split
10579 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
10580 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
10581 [(match_operand 2 "cc_reg_operand" "")
10582 (const_int 0)])
10583 (const_int 0)))
10584 (set (match_operand:SI 3 "gpc_reg_operand" "")
10585 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
10586 "! TARGET_POWERPC64 && reload_completed"
10587 [(set (match_dup 3)
10588 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
10589 (set (match_dup 0)
10590 (compare:CC (match_dup 3)
10591 (const_int 0)))]
10592 "")
10593
10594 (define_insn ""
10595 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10596 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
10597 [(match_operand 2 "cc_reg_operand" "y")
10598 (const_int 0)])
10599 (match_operand:SI 3 "const_int_operand" "n")))]
10600 ""
10601 "*
10602 {
10603 int is_bit = ccr_bit (operands[1], 1);
10604 int put_bit = 31 - (INTVAL (operands[3]) & 31);
10605 int count;
10606
10607 if (is_bit >= put_bit)
10608 count = is_bit - put_bit;
10609 else
10610 count = 32 - (put_bit - is_bit);
10611
10612 operands[4] = GEN_INT (count);
10613 operands[5] = GEN_INT (put_bit);
10614
10615 return \"%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
10616 }"
10617 [(set_attr "length" "12")])
10618
10619 (define_insn ""
10620 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
10621 (compare:CC
10622 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
10623 [(match_operand 2 "cc_reg_operand" "y,y")
10624 (const_int 0)])
10625 (match_operand:SI 3 "const_int_operand" "n,n"))
10626 (const_int 0)))
10627 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
10628 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
10629 (match_dup 3)))]
10630 "! TARGET_POWERPC64"
10631 "*
10632 {
10633 int is_bit = ccr_bit (operands[1], 1);
10634 int put_bit = 31 - (INTVAL (operands[3]) & 31);
10635 int count;
10636
10637 /* Force split for non-cc0 compare. */
10638 if (which_alternative == 1)
10639 return \"#\";
10640
10641 if (is_bit >= put_bit)
10642 count = is_bit - put_bit;
10643 else
10644 count = 32 - (put_bit - is_bit);
10645
10646 operands[5] = GEN_INT (count);
10647 operands[6] = GEN_INT (put_bit);
10648
10649 return \"%D1mfcr %4\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
10650 }"
10651 [(set_attr "type" "delayed_compare")
10652 (set_attr "length" "12,16")])
10653
10654 (define_split
10655 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
10656 (compare:CC
10657 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
10658 [(match_operand 2 "cc_reg_operand" "")
10659 (const_int 0)])
10660 (match_operand:SI 3 "const_int_operand" ""))
10661 (const_int 0)))
10662 (set (match_operand:SI 4 "gpc_reg_operand" "")
10663 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
10664 (match_dup 3)))]
10665 "! TARGET_POWERPC64 && reload_completed"
10666 [(set (match_dup 4)
10667 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
10668 (match_dup 3)))
10669 (set (match_dup 0)
10670 (compare:CC (match_dup 4)
10671 (const_int 0)))]
10672 "")
10673
10674 ;; There is a 3 cycle delay between consecutive mfcr instructions
10675 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
10676
10677 (define_peephole
10678 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10679 (match_operator:SI 1 "scc_comparison_operator"
10680 [(match_operand 2 "cc_reg_operand" "y")
10681 (const_int 0)]))
10682 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
10683 (match_operator:SI 4 "scc_comparison_operator"
10684 [(match_operand 5 "cc_reg_operand" "y")
10685 (const_int 0)]))]
10686 "REGNO (operands[2]) != REGNO (operands[5])"
10687 "%D1%D4mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
10688 [(set_attr "length" "20")])
10689
10690 (define_peephole
10691 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10692 (match_operator:DI 1 "scc_comparison_operator"
10693 [(match_operand 2 "cc_reg_operand" "y")
10694 (const_int 0)]))
10695 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
10696 (match_operator:DI 4 "scc_comparison_operator"
10697 [(match_operand 5 "cc_reg_operand" "y")
10698 (const_int 0)]))]
10699 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
10700 "%D1%D4mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
10701 [(set_attr "length" "20")])
10702
10703 ;; There are some scc insns that can be done directly, without a compare.
10704 ;; These are faster because they don't involve the communications between
10705 ;; the FXU and branch units. In fact, we will be replacing all of the
10706 ;; integer scc insns here or in the portable methods in emit_store_flag.
10707 ;;
10708 ;; Also support (neg (scc ..)) since that construct is used to replace
10709 ;; branches, (plus (scc ..) ..) since that construct is common and
10710 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
10711 ;; cases where it is no more expensive than (neg (scc ..)).
10712
10713 ;; Have reload force a constant into a register for the simple insns that
10714 ;; otherwise won't accept constants. We do this because it is faster than
10715 ;; the cmp/mfcr sequence we would otherwise generate.
10716
10717 (define_insn ""
10718 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
10719 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
10720 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
10721 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
10722 "! TARGET_POWERPC64"
10723 "@
10724 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
10725 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
10726 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
10727 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
10728 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
10729 [(set_attr "length" "12,8,12,12,12")])
10730
10731 (define_insn ""
10732 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r")
10733 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r")
10734 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I")))
10735 (clobber (match_scratch:DI 3 "=r,&r,r,r,r"))]
10736 "TARGET_POWERPC64"
10737 "@
10738 xor %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0
10739 subfic %3,%1,0\;adde %0,%3,%1
10740 xori %0,%1,%b2\;subfic %3,%0,0\;adde %0,%3,%0
10741 xoris %0,%1,%u2\;subfic %3,%0,0\;adde %0,%3,%0
10742 subfic %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0"
10743 [(set_attr "length" "12,8,12,12,12")])
10744
10745 (define_insn ""
10746 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
10747 (compare:CC
10748 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
10749 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
10750 (const_int 0)))
10751 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
10752 (eq:SI (match_dup 1) (match_dup 2)))
10753 (clobber (match_scratch:SI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
10754 "! TARGET_POWERPC64"
10755 "@
10756 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
10757 {sfi|subfic} %3,%1,0\;{ae.|adde.} %0,%3,%1
10758 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
10759 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
10760 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
10761 #
10762 #
10763 #
10764 #
10765 #"
10766 [(set_attr "type" "compare")
10767 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
10768
10769 (define_split
10770 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
10771 (compare:CC
10772 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
10773 (match_operand:SI 2 "reg_or_cint_operand" ""))
10774 (const_int 0)))
10775 (set (match_operand:SI 0 "gpc_reg_operand" "")
10776 (eq:SI (match_dup 1) (match_dup 2)))
10777 (clobber (match_scratch:SI 3 ""))]
10778 "! TARGET_POWERPC64 && reload_completed"
10779 [(parallel [(set (match_dup 0)
10780 (eq:SI (match_dup 1) (match_dup 2)))
10781 (clobber (match_dup 3))])
10782 (set (match_dup 4)
10783 (compare:CC (match_dup 0)
10784 (const_int 0)))]
10785 "")
10786
10787 (define_insn ""
10788 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
10789 (compare:CC
10790 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
10791 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I,r,O,K,J,I"))
10792 (const_int 0)))
10793 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
10794 (eq:DI (match_dup 1) (match_dup 2)))
10795 (clobber (match_scratch:DI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
10796 "TARGET_POWERPC64"
10797 "@
10798 xor %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
10799 subfic %3,%1,0\;adde. %0,%3,%1
10800 xori %0,%1,%b2\;subfic %3,%0,0\;adde. %0,%3,%0
10801 xoris %0,%1,%u2\;subfic %3,%0,0\;adde. %0,%3,%0
10802 subfic %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
10803 #
10804 #
10805 #
10806 #
10807 #"
10808 [(set_attr "type" "compare")
10809 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
10810
10811 (define_split
10812 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
10813 (compare:CC
10814 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "")
10815 (match_operand:DI 2 "reg_or_cint_operand" ""))
10816 (const_int 0)))
10817 (set (match_operand:DI 0 "gpc_reg_operand" "")
10818 (eq:DI (match_dup 1) (match_dup 2)))
10819 (clobber (match_scratch:DI 3 ""))]
10820 "TARGET_POWERPC64 && reload_completed"
10821 [(parallel [(set (match_dup 0)
10822 (eq:DI (match_dup 1) (match_dup 2)))
10823 (clobber (match_dup 3))])
10824 (set (match_dup 4)
10825 (compare:CC (match_dup 0)
10826 (const_int 0)))]
10827 "")
10828
10829 ;; We have insns of the form shown by the first define_insn below. If
10830 ;; there is something inside the comparison operation, we must split it.
10831 (define_split
10832 [(set (match_operand:SI 0 "gpc_reg_operand" "")
10833 (plus:SI (match_operator 1 "comparison_operator"
10834 [(match_operand:SI 2 "" "")
10835 (match_operand:SI 3
10836 "reg_or_cint_operand" "")])
10837 (match_operand:SI 4 "gpc_reg_operand" "")))
10838 (clobber (match_operand:SI 5 "register_operand" ""))]
10839 "! gpc_reg_operand (operands[2], SImode)"
10840 [(set (match_dup 5) (match_dup 2))
10841 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
10842 (match_dup 4)))])
10843
10844 (define_insn ""
10845 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
10846 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
10847 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I"))
10848 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
10849 "! TARGET_POWERPC64"
10850 "@
10851 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
10852 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
10853 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
10854 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
10855 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
10856 [(set_attr "length" "12,8,12,12,12")])
10857
10858 (define_insn ""
10859 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
10860 (compare:CC
10861 (plus:SI
10862 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
10863 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
10864 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
10865 (const_int 0)))
10866 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
10867 "! TARGET_POWERPC64"
10868 "@
10869 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
10870 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
10871 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
10872 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
10873 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
10874 #
10875 #
10876 #
10877 #
10878 #"
10879 [(set_attr "type" "compare")
10880 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
10881
10882 (define_split
10883 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
10884 (compare:CC
10885 (plus:SI
10886 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
10887 (match_operand:SI 2 "reg_or_cint_operand" ""))
10888 (match_operand:SI 3 "gpc_reg_operand" ""))
10889 (const_int 0)))
10890 (clobber (match_scratch:SI 4 ""))]
10891 "! TARGET_POWERPC64 && reload_completed"
10892 [(set (match_dup 4)
10893 (plus:SI (eq:SI (match_dup 1)
10894 (match_dup 2))
10895 (match_dup 3)))
10896 (set (match_dup 0)
10897 (compare:CC (match_dup 4)
10898 (const_int 0)))]
10899 "")
10900
10901 (define_insn ""
10902 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
10903 (compare:CC
10904 (plus:SI
10905 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
10906 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
10907 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
10908 (const_int 0)))
10909 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
10910 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
10911 "! TARGET_POWERPC64"
10912 "@
10913 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
10914 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
10915 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
10916 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
10917 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
10918 #
10919 #
10920 #
10921 #
10922 #"
10923 [(set_attr "type" "compare")
10924 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
10925
10926 (define_split
10927 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
10928 (compare:CC
10929 (plus:SI
10930 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
10931 (match_operand:SI 2 "reg_or_cint_operand" ""))
10932 (match_operand:SI 3 "gpc_reg_operand" ""))
10933 (const_int 0)))
10934 (set (match_operand:SI 0 "gpc_reg_operand" "")
10935 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
10936 "! TARGET_POWERPC64 && reload_completed"
10937 [(set (match_dup 0)
10938 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
10939 (set (match_dup 4)
10940 (compare:CC (match_dup 0)
10941 (const_int 0)))]
10942 "")
10943
10944 (define_insn ""
10945 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
10946 (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
10947 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I"))))]
10948 "! TARGET_POWERPC64"
10949 "@
10950 xor %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
10951 {ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0
10952 {xoril|xori} %0,%1,%b2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
10953 {xoriu|xoris} %0,%1,%u2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
10954 {sfi|subfic} %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
10955 [(set_attr "length" "12,8,12,12,12")])
10956
10957 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
10958 ;; since it nabs/sr is just as fast.
10959 (define_insn "*ne0"
10960 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
10961 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
10962 (const_int 31)))
10963 (clobber (match_scratch:SI 2 "=&r"))]
10964 "! TARGET_POWER && ! TARGET_POWERPC64"
10965 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
10966 [(set_attr "length" "8")])
10967
10968 (define_insn ""
10969 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10970 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
10971 (const_int 63)))
10972 (clobber (match_scratch:DI 2 "=&r"))]
10973 "TARGET_POWERPC64"
10974 "addic %2,%1,-1\;subfe %0,%2,%1"
10975 [(set_attr "length" "8")])
10976
10977 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
10978 (define_insn ""
10979 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10980 (plus:SI (lshiftrt:SI
10981 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
10982 (const_int 31))
10983 (match_operand:SI 2 "gpc_reg_operand" "r")))
10984 (clobber (match_scratch:SI 3 "=&r"))]
10985 "! TARGET_POWERPC64"
10986 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
10987 [(set_attr "length" "8")])
10988
10989 (define_insn ""
10990 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10991 (plus:DI (lshiftrt:DI
10992 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
10993 (const_int 63))
10994 (match_operand:DI 2 "gpc_reg_operand" "r")))
10995 (clobber (match_scratch:DI 3 "=&r"))]
10996 "TARGET_POWERPC64"
10997 "addic %3,%1,-1\;addze %0,%2"
10998 [(set_attr "length" "8")])
10999
11000 (define_insn ""
11001 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11002 (compare:CC
11003 (plus:SI (lshiftrt:SI
11004 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11005 (const_int 31))
11006 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11007 (const_int 0)))
11008 (clobber (match_scratch:SI 3 "=&r,&r"))
11009 (clobber (match_scratch:SI 4 "=X,&r"))]
11010 "! TARGET_POWERPC64"
11011 "@
11012 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
11013 #"
11014 [(set_attr "type" "compare")
11015 (set_attr "length" "8,12")])
11016
11017 (define_split
11018 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11019 (compare:CC
11020 (plus:SI (lshiftrt:SI
11021 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11022 (const_int 31))
11023 (match_operand:SI 2 "gpc_reg_operand" ""))
11024 (const_int 0)))
11025 (clobber (match_scratch:SI 3 ""))
11026 (clobber (match_scratch:SI 4 ""))]
11027 "! TARGET_POWERPC64 && reload_completed"
11028 [(parallel [(set (match_dup 3)
11029 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
11030 (const_int 31))
11031 (match_dup 2)))
11032 (clobber (match_dup 4))])
11033 (set (match_dup 0)
11034 (compare:CC (match_dup 3)
11035 (const_int 0)))]
11036 "")
11037
11038 (define_insn ""
11039 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11040 (compare:CC
11041 (plus:DI (lshiftrt:DI
11042 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11043 (const_int 63))
11044 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11045 (const_int 0)))
11046 (clobber (match_scratch:DI 3 "=&r,&r"))]
11047 "TARGET_POWERPC64"
11048 "@
11049 addic %3,%1,-1\;addze. %3,%2
11050 #"
11051 [(set_attr "type" "compare")
11052 (set_attr "length" "8,12")])
11053
11054 (define_split
11055 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11056 (compare:CC
11057 (plus:DI (lshiftrt:DI
11058 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11059 (const_int 63))
11060 (match_operand:DI 2 "gpc_reg_operand" ""))
11061 (const_int 0)))
11062 (clobber (match_scratch:DI 3 ""))]
11063 "TARGET_POWERPC64 && reload_completed"
11064 [(set (match_dup 3)
11065 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
11066 (const_int 63))
11067 (match_dup 2)))
11068 (set (match_dup 0)
11069 (compare:CC (match_dup 3)
11070 (const_int 0)))]
11071 "")
11072
11073 (define_insn ""
11074 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11075 (compare:CC
11076 (plus:SI (lshiftrt:SI
11077 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11078 (const_int 31))
11079 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11080 (const_int 0)))
11081 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11082 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11083 (match_dup 2)))
11084 (clobber (match_scratch:SI 3 "=&r,&r"))]
11085 "! TARGET_POWERPC64"
11086 "@
11087 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
11088 #"
11089 [(set_attr "type" "compare")
11090 (set_attr "length" "8,12")])
11091
11092 (define_split
11093 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11094 (compare:CC
11095 (plus:SI (lshiftrt:SI
11096 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11097 (const_int 31))
11098 (match_operand:SI 2 "gpc_reg_operand" ""))
11099 (const_int 0)))
11100 (set (match_operand:SI 0 "gpc_reg_operand" "")
11101 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11102 (match_dup 2)))
11103 (clobber (match_scratch:SI 3 ""))]
11104 "! TARGET_POWERPC64 && reload_completed"
11105 [(parallel [(set (match_dup 0)
11106 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11107 (match_dup 2)))
11108 (clobber (match_dup 3))])
11109 (set (match_dup 4)
11110 (compare:CC (match_dup 0)
11111 (const_int 0)))]
11112 "")
11113
11114 (define_insn ""
11115 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11116 (compare:CC
11117 (plus:DI (lshiftrt:DI
11118 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11119 (const_int 63))
11120 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11121 (const_int 0)))
11122 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11123 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11124 (match_dup 2)))
11125 (clobber (match_scratch:DI 3 "=&r,&r"))]
11126 "TARGET_POWERPC64"
11127 "@
11128 addic %3,%1,-1\;addze. %0,%2
11129 #"
11130 [(set_attr "type" "compare")
11131 (set_attr "length" "8,12")])
11132
11133 (define_split
11134 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11135 (compare:CC
11136 (plus:DI (lshiftrt:DI
11137 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11138 (const_int 63))
11139 (match_operand:DI 2 "gpc_reg_operand" ""))
11140 (const_int 0)))
11141 (set (match_operand:DI 0 "gpc_reg_operand" "")
11142 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11143 (match_dup 2)))
11144 (clobber (match_scratch:DI 3 ""))]
11145 "TARGET_POWERPC64 && reload_completed"
11146 [(parallel [(set (match_dup 0)
11147 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11148 (match_dup 2)))
11149 (clobber (match_dup 3))])
11150 (set (match_dup 4)
11151 (compare:CC (match_dup 0)
11152 (const_int 0)))]
11153 "")
11154
11155 (define_insn ""
11156 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11157 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11158 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
11159 (clobber (match_scratch:SI 3 "=r,X"))]
11160 "TARGET_POWER"
11161 "@
11162 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
11163 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
11164 [(set_attr "length" "12")])
11165
11166 (define_insn ""
11167 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
11168 (compare:CC
11169 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11170 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11171 (const_int 0)))
11172 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
11173 (le:SI (match_dup 1) (match_dup 2)))
11174 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
11175 "TARGET_POWER"
11176 "@
11177 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
11178 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
11179 #
11180 #"
11181 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
11182 (set_attr "length" "12,12,16,16")])
11183
11184 (define_split
11185 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11186 (compare:CC
11187 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11188 (match_operand:SI 2 "reg_or_short_operand" ""))
11189 (const_int 0)))
11190 (set (match_operand:SI 0 "gpc_reg_operand" "")
11191 (le:SI (match_dup 1) (match_dup 2)))
11192 (clobber (match_scratch:SI 3 ""))]
11193 "TARGET_POWER && reload_completed"
11194 [(parallel [(set (match_dup 0)
11195 (le:SI (match_dup 1) (match_dup 2)))
11196 (clobber (match_dup 3))])
11197 (set (match_dup 4)
11198 (compare:CC (match_dup 0)
11199 (const_int 0)))]
11200 "")
11201
11202 (define_insn ""
11203 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11204 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11205 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
11206 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
11207 (clobber (match_scratch:SI 4 "=&r,&r"))]
11208 "TARGET_POWER"
11209 "@
11210 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
11211 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze|addze} %0,%3"
11212 [(set_attr "length" "12")])
11213
11214 (define_insn ""
11215 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
11216 (compare:CC
11217 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11218 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11219 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
11220 (const_int 0)))
11221 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
11222 "TARGET_POWER"
11223 "@
11224 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11225 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
11226 #
11227 #"
11228 [(set_attr "type" "compare")
11229 (set_attr "length" "12,12,16,16")])
11230
11231 (define_split
11232 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11233 (compare:CC
11234 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11235 (match_operand:SI 2 "reg_or_short_operand" ""))
11236 (match_operand:SI 3 "gpc_reg_operand" ""))
11237 (const_int 0)))
11238 (clobber (match_scratch:SI 4 ""))]
11239 "TARGET_POWER && reload_completed"
11240 [(set (match_dup 4)
11241 (plus:SI (le:SI (match_dup 1) (match_dup 2))
11242 (match_dup 3)))
11243 (set (match_dup 0)
11244 (compare:CC (match_dup 4)
11245 (const_int 0)))]
11246 "")
11247
11248 (define_insn ""
11249 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,?y,?y")
11250 (compare:CC
11251 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11252 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11253 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
11254 (const_int 0)))
11255 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
11256 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11257 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
11258 "TARGET_POWER"
11259 "@
11260 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
11261 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %0,%3
11262 #
11263 #"
11264 [(set_attr "type" "compare")
11265 (set_attr "length" "12,12,16,16")])
11266
11267 (define_split
11268 [(set (match_operand:CC 5 "cc_reg_not_cr0_operand" "")
11269 (compare:CC
11270 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11271 (match_operand:SI 2 "reg_or_short_operand" ""))
11272 (match_operand:SI 3 "gpc_reg_operand" ""))
11273 (const_int 0)))
11274 (set (match_operand:SI 0 "gpc_reg_operand" "")
11275 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11276 (clobber (match_scratch:SI 4 ""))]
11277 "TARGET_POWER && reload_completed"
11278 [(parallel [(set (match_dup 0)
11279 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11280 (clobber (match_dup 4))])
11281 (set (match_dup 5)
11282 (compare:CC (match_dup 0)
11283 (const_int 0)))]
11284 "")
11285
11286 (define_insn ""
11287 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11288 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11289 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
11290 "TARGET_POWER"
11291 "@
11292 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11293 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
11294 [(set_attr "length" "12")])
11295
11296 (define_insn ""
11297 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11298 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11299 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
11300 "! TARGET_POWERPC64"
11301 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
11302 [(set_attr "length" "12")])
11303
11304 (define_insn ""
11305 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11306 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
11307 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
11308 "TARGET_POWERPC64"
11309 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
11310 [(set_attr "length" "12")])
11311
11312 (define_insn ""
11313 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
11314 (compare:CC
11315 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
11316 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
11317 (const_int 0)))
11318 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11319 (leu:DI (match_dup 1) (match_dup 2)))]
11320 "TARGET_POWERPC64"
11321 "@
11322 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
11323 #"
11324 [(set_attr "type" "compare")
11325 (set_attr "length" "12,16")])
11326
11327 (define_split
11328 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
11329 (compare:CC
11330 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "")
11331 (match_operand:DI 2 "reg_or_short_operand" ""))
11332 (const_int 0)))
11333 (set (match_operand:DI 0 "gpc_reg_operand" "")
11334 (leu:DI (match_dup 1) (match_dup 2)))]
11335 "TARGET_POWERPC64 && reload_completed"
11336 [(set (match_dup 0)
11337 (leu:DI (match_dup 1) (match_dup 2)))
11338 (set (match_dup 3)
11339 (compare:CC (match_dup 0)
11340 (const_int 0)))]
11341 "")
11342
11343 (define_insn ""
11344 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
11345 (compare:CC
11346 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11347 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11348 (const_int 0)))
11349 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11350 (leu:SI (match_dup 1) (match_dup 2)))]
11351 "! TARGET_POWERPC64"
11352 "@
11353 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
11354 #"
11355 [(set_attr "type" "compare")
11356 (set_attr "length" "12,16")])
11357
11358 (define_split
11359 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
11360 (compare:CC
11361 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11362 (match_operand:SI 2 "reg_or_short_operand" ""))
11363 (const_int 0)))
11364 (set (match_operand:SI 0 "gpc_reg_operand" "")
11365 (leu:SI (match_dup 1) (match_dup 2)))]
11366 "! TARGET_POWERPC64 && reload_completed"
11367 [(set (match_dup 0)
11368 (leu:SI (match_dup 1) (match_dup 2)))
11369 (set (match_dup 3)
11370 (compare:CC (match_dup 0)
11371 (const_int 0)))]
11372 "")
11373
11374 (define_insn ""
11375 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
11376 (compare:CC
11377 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
11378 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
11379 (const_int 0)))
11380 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11381 (leu:DI (match_dup 1) (match_dup 2)))]
11382 "TARGET_POWERPC64"
11383 "@
11384 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
11385 #"
11386 [(set_attr "type" "compare")
11387 (set_attr "length" "12,16")])
11388
11389 (define_insn ""
11390 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11391 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11392 (match_operand:SI 2 "reg_or_short_operand" "rI"))
11393 (match_operand:SI 3 "gpc_reg_operand" "r")))]
11394 "! TARGET_POWERPC64"
11395 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
11396 [(set_attr "length" "8")])
11397
11398 (define_insn ""
11399 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11400 (compare:CC
11401 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11402 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11403 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11404 (const_int 0)))
11405 (clobber (match_scratch:SI 4 "=&r,&r"))]
11406 "! TARGET_POWERPC64"
11407 "@
11408 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
11409 #"
11410 [(set_attr "type" "compare")
11411 (set_attr "length" "8,12")])
11412
11413 (define_split
11414 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11415 (compare:CC
11416 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11417 (match_operand:SI 2 "reg_or_short_operand" ""))
11418 (match_operand:SI 3 "gpc_reg_operand" ""))
11419 (const_int 0)))
11420 (clobber (match_scratch:SI 4 ""))]
11421 "! TARGET_POWERPC64 && reload_completed"
11422 [(set (match_dup 4)
11423 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
11424 (match_dup 3)))
11425 (set (match_dup 0)
11426 (compare:CC (match_dup 4)
11427 (const_int 0)))]
11428 "")
11429
11430 (define_insn ""
11431 [(set (match_operand:CC 5 "cc_reg_operand" "=x,?y")
11432 (compare:CC
11433 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11434 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11435 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11436 (const_int 0)))
11437 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11438 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11439 (clobber (match_scratch:SI 4 "=&r,&r"))]
11440 "! TARGET_POWERPC64"
11441 "@
11442 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %0,%3
11443 #"
11444 [(set_attr "type" "compare")
11445 (set_attr "length" "8,12")])
11446
11447 (define_split
11448 [(set (match_operand:CC 5 "cc_reg_not_cr0_operand" "")
11449 (compare:CC
11450 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11451 (match_operand:SI 2 "reg_or_short_operand" ""))
11452 (match_operand:SI 3 "gpc_reg_operand" ""))
11453 (const_int 0)))
11454 (set (match_operand:SI 0 "gpc_reg_operand" "")
11455 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11456 (clobber (match_scratch:SI 4 ""))]
11457 "! TARGET_POWERPC64 && reload_completed"
11458 [(parallel [(set (match_dup 0)
11459 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11460 (clobber (match_dup 4))])
11461 (set (match_dup 5)
11462 (compare:CC (match_dup 0)
11463 (const_int 0)))]
11464 "")
11465
11466 (define_insn ""
11467 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11468 (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11469 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
11470 "! TARGET_POWERPC64"
11471 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
11472 [(set_attr "length" "12")])
11473
11474 (define_insn ""
11475 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11476 (and:SI (neg:SI
11477 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11478 (match_operand:SI 2 "reg_or_short_operand" "rI")))
11479 (match_operand:SI 3 "gpc_reg_operand" "r")))
11480 (clobber (match_scratch:SI 4 "=&r"))]
11481 "! TARGET_POWERPC64"
11482 "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4"
11483 [(set_attr "length" "12")])
11484
11485 (define_insn ""
11486 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11487 (compare:CC
11488 (and:SI (neg:SI
11489 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11490 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
11491 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11492 (const_int 0)))
11493 (clobber (match_scratch:SI 4 "=&r,&r"))]
11494 "! TARGET_POWERPC64"
11495 "@
11496 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
11497 #"
11498 [(set_attr "type" "compare")
11499 (set_attr "length" "12,16")])
11500
11501 (define_split
11502 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11503 (compare:CC
11504 (and:SI (neg:SI
11505 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11506 (match_operand:SI 2 "reg_or_short_operand" "")))
11507 (match_operand:SI 3 "gpc_reg_operand" ""))
11508 (const_int 0)))
11509 (clobber (match_scratch:SI 4 ""))]
11510 "! TARGET_POWERPC64 && reload_completed"
11511 [(set (match_dup 4)
11512 (and:SI (neg:SI (leu:SI (match_dup 1)
11513 (match_dup 2)))
11514 (match_dup 3)))
11515 (set (match_dup 0)
11516 (compare:CC (match_dup 4)
11517 (const_int 0)))]
11518 "")
11519
11520 (define_insn ""
11521 [(set (match_operand:CC 5 "cc_reg_operand" "=x,?y")
11522 (compare:CC
11523 (and:SI (neg:SI
11524 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11525 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
11526 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11527 (const_int 0)))
11528 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11529 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
11530 (clobber (match_scratch:SI 4 "=&r,&r"))]
11531 "! TARGET_POWERPC64"
11532 "@
11533 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4
11534 #"
11535 [(set_attr "type" "compare")
11536 (set_attr "length" "12,16")])
11537
11538 (define_split
11539 [(set (match_operand:CC 5 "cc_reg_not_cr0_operand" "")
11540 (compare:CC
11541 (and:SI (neg:SI
11542 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11543 (match_operand:SI 2 "reg_or_short_operand" "")))
11544 (match_operand:SI 3 "gpc_reg_operand" ""))
11545 (const_int 0)))
11546 (set (match_operand:SI 0 "gpc_reg_operand" "")
11547 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
11548 (clobber (match_scratch:SI 4 ""))]
11549 "! TARGET_POWERPC64 && reload_completed"
11550 [(parallel [(set (match_dup 0)
11551 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
11552 (clobber (match_dup 4))])
11553 (set (match_dup 5)
11554 (compare:CC (match_dup 0)
11555 (const_int 0)))]
11556 "")
11557
11558 (define_insn ""
11559 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11560 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11561 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
11562 "TARGET_POWER"
11563 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
11564 [(set_attr "length" "12")])
11565
11566 (define_insn ""
11567 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
11568 (compare:CC
11569 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11570 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11571 (const_int 0)))
11572 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11573 (lt:SI (match_dup 1) (match_dup 2)))]
11574 "TARGET_POWER"
11575 "@
11576 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
11577 #"
11578 [(set_attr "type" "delayed_compare")
11579 (set_attr "length" "12,16")])
11580
11581 (define_split
11582 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
11583 (compare:CC
11584 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
11585 (match_operand:SI 2 "reg_or_short_operand" ""))
11586 (const_int 0)))
11587 (set (match_operand:SI 0 "gpc_reg_operand" "")
11588 (lt:SI (match_dup 1) (match_dup 2)))]
11589 "TARGET_POWER && reload_completed"
11590 [(set (match_dup 0)
11591 (lt:SI (match_dup 1) (match_dup 2)))
11592 (set (match_dup 3)
11593 (compare:CC (match_dup 0)
11594 (const_int 0)))]
11595 "")
11596
11597 (define_insn ""
11598 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11599 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11600 (match_operand:SI 2 "reg_or_short_operand" "rI"))
11601 (match_operand:SI 3 "gpc_reg_operand" "r")))
11602 (clobber (match_scratch:SI 4 "=&r"))]
11603 "TARGET_POWER"
11604 "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze|addze} %0,%3"
11605 [(set_attr "length" "12")])
11606
11607 (define_insn ""
11608 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11609 (compare:CC
11610 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11611 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11612 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11613 (const_int 0)))
11614 (clobber (match_scratch:SI 4 "=&r,&r"))]
11615 "TARGET_POWER"
11616 "@
11617 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
11618 #"
11619 [(set_attr "type" "compare")
11620 (set_attr "length" "12,16")])
11621
11622 (define_split
11623 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11624 (compare:CC
11625 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
11626 (match_operand:SI 2 "reg_or_short_operand" ""))
11627 (match_operand:SI 3 "gpc_reg_operand" ""))
11628 (const_int 0)))
11629 (clobber (match_scratch:SI 4 ""))]
11630 "TARGET_POWER && reload_completed"
11631 [(set (match_dup 4)
11632 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
11633 (match_dup 3)))
11634 (set (match_dup 0)
11635 (compare:CC (match_dup 4)
11636 (const_int 0)))]
11637 "")
11638
11639 (define_insn ""
11640 [(set (match_operand:CC 5 "cc_reg_operand" "=x,?y")
11641 (compare:CC
11642 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11643 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11644 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11645 (const_int 0)))
11646 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11647 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11648 (clobber (match_scratch:SI 4 "=&r,&r"))]
11649 "TARGET_POWER"
11650 "@
11651 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %0,%3
11652 #"
11653 [(set_attr "type" "compare")
11654 (set_attr "length" "12,16")])
11655
11656 (define_split
11657 [(set (match_operand:CC 5 "cc_reg_not_cr0_operand" "")
11658 (compare:CC
11659 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
11660 (match_operand:SI 2 "reg_or_short_operand" ""))
11661 (match_operand:SI 3 "gpc_reg_operand" ""))
11662 (const_int 0)))
11663 (set (match_operand:SI 0 "gpc_reg_operand" "")
11664 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11665 (clobber (match_scratch:SI 4 ""))]
11666 "TARGET_POWER && reload_completed"
11667 [(parallel [(set (match_dup 0)
11668 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11669 (clobber (match_dup 4))])
11670 (set (match_dup 5)
11671 (compare:CC (match_dup 0)
11672 (const_int 0)))]
11673 "")
11674
11675 (define_insn ""
11676 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11677 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11678 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
11679 "TARGET_POWER"
11680 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
11681 [(set_attr "length" "12")])
11682
11683 (define_insn ""
11684 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11685 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11686 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
11687 "! TARGET_POWERPC64"
11688 "@
11689 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg %0,%0
11690 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
11691 [(set_attr "length" "12")])
11692
11693 (define_insn ""
11694 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
11695 (compare:CC
11696 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11697 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
11698 (const_int 0)))
11699 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
11700 (ltu:SI (match_dup 1) (match_dup 2)))]
11701 "! TARGET_POWERPC64"
11702 "@
11703 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
11704 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
11705 #
11706 #"
11707 [(set_attr "type" "compare")
11708 (set_attr "length" "12,12,16,16")])
11709
11710 (define_split
11711 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
11712 (compare:CC
11713 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11714 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
11715 (const_int 0)))
11716 (set (match_operand:SI 0 "gpc_reg_operand" "")
11717 (ltu:SI (match_dup 1) (match_dup 2)))]
11718 "! TARGET_POWERPC64 && reload_completed"
11719 [(set (match_dup 0)
11720 (ltu:SI (match_dup 1) (match_dup 2)))
11721 (set (match_dup 3)
11722 (compare:CC (match_dup 0)
11723 (const_int 0)))]
11724 "")
11725
11726 (define_insn ""
11727 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
11728 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11729 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
11730 (match_operand:SI 3 "reg_or_short_operand" "rI,rI")))]
11731 "! TARGET_POWERPC64"
11732 "@
11733 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3
11734 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3"
11735 [(set_attr "length" "12")])
11736
11737 (define_insn ""
11738 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
11739 (compare:CC
11740 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11741 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
11742 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
11743 (const_int 0)))
11744 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
11745 "! TARGET_POWERPC64"
11746 "@
11747 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
11748 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
11749 #
11750 #"
11751 [(set_attr "type" "compare")
11752 (set_attr "length" "12,12,16,16")])
11753
11754 (define_split
11755 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11756 (compare:CC
11757 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11758 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
11759 (match_operand:SI 3 "gpc_reg_operand" ""))
11760 (const_int 0)))
11761 (clobber (match_scratch:SI 4 ""))]
11762 "! TARGET_POWERPC64 && reload_completed"
11763 [(set (match_dup 4)
11764 (plus:SI (ltu:SI (match_dup 1) (match_dup 2))
11765 (match_dup 3)))
11766 (set (match_dup 0)
11767 (compare:CC (match_dup 4)
11768 (const_int 0)))]
11769 "")
11770
11771 (define_insn ""
11772 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,?y,?y")
11773 (compare:CC
11774 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11775 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
11776 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
11777 (const_int 0)))
11778 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
11779 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11780 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
11781 "! TARGET_POWERPC64"
11782 "@
11783 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3
11784 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3
11785 #
11786 #"
11787 [(set_attr "type" "compare")
11788 (set_attr "length" "12,12,16,16")])
11789
11790 (define_split
11791 [(set (match_operand:CC 5 "cc_reg_not_cr0_operand" "")
11792 (compare:CC
11793 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11794 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
11795 (match_operand:SI 3 "gpc_reg_operand" ""))
11796 (const_int 0)))
11797 (set (match_operand:SI 0 "gpc_reg_operand" "")
11798 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11799 (clobber (match_scratch:SI 4 ""))]
11800 "! TARGET_POWERPC64 && reload_completed"
11801 [(parallel [(set (match_dup 0)
11802 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11803 (clobber (match_dup 4))])
11804 (set (match_dup 5)
11805 (compare:CC (match_dup 0)
11806 (const_int 0)))]
11807 "")
11808
11809 (define_insn ""
11810 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11811 (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11812 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
11813 "! TARGET_POWERPC64"
11814 "@
11815 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
11816 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
11817 [(set_attr "length" "8")])
11818
11819 (define_insn ""
11820 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11821 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11822 (match_operand:SI 2 "reg_or_short_operand" "rI")))
11823 (clobber (match_scratch:SI 3 "=r"))]
11824 "TARGET_POWER"
11825 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
11826 [(set_attr "length" "12")])
11827
11828 (define_insn ""
11829 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11830 (compare:CC
11831 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11832 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11833 (const_int 0)))
11834 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11835 (ge:SI (match_dup 1) (match_dup 2)))
11836 (clobber (match_scratch:SI 3 "=r,r"))]
11837 "TARGET_POWER"
11838 "@
11839 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
11840 #"
11841 [(set_attr "type" "compare")
11842 (set_attr "length" "12,16")])
11843
11844 (define_split
11845 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11846 (compare:CC
11847 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
11848 (match_operand:SI 2 "reg_or_short_operand" ""))
11849 (const_int 0)))
11850 (set (match_operand:SI 0 "gpc_reg_operand" "")
11851 (ge:SI (match_dup 1) (match_dup 2)))
11852 (clobber (match_scratch:SI 3 ""))]
11853 "TARGET_POWER && reload_completed"
11854 [(parallel [(set (match_dup 0)
11855 (ge:SI (match_dup 1) (match_dup 2)))
11856 (clobber (match_dup 3))])
11857 (set (match_dup 4)
11858 (compare:CC (match_dup 0)
11859 (const_int 0)))]
11860 "")
11861
11862 (define_insn ""
11863 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11864 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11865 (match_operand:SI 2 "reg_or_short_operand" "rI"))
11866 (match_operand:SI 3 "gpc_reg_operand" "r")))
11867 (clobber (match_scratch:SI 4 "=&r"))]
11868 "TARGET_POWER"
11869 "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3"
11870 [(set_attr "length" "12")])
11871
11872 (define_insn ""
11873 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11874 (compare:CC
11875 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11876 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11877 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11878 (const_int 0)))
11879 (clobber (match_scratch:SI 4 "=&r,&r"))]
11880 "TARGET_POWER"
11881 "@
11882 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11883 #"
11884 [(set_attr "type" "compare")
11885 (set_attr "length" "12,16")])
11886
11887 (define_split
11888 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11889 (compare:CC
11890 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
11891 (match_operand:SI 2 "reg_or_short_operand" ""))
11892 (match_operand:SI 3 "gpc_reg_operand" ""))
11893 (const_int 0)))
11894 (clobber (match_scratch:SI 4 ""))]
11895 "TARGET_POWER && reload_completed"
11896 [(set (match_dup 4)
11897 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
11898 (match_dup 3)))
11899 (set (match_dup 0)
11900 (compare:CC (match_dup 4)
11901 (const_int 0)))]
11902 "")
11903
11904 (define_insn ""
11905 [(set (match_operand:CC 5 "cc_reg_operand" "=x,?y")
11906 (compare:CC
11907 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11908 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11909 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11910 (const_int 0)))
11911 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11912 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11913 (clobber (match_scratch:SI 4 "=&r,&r"))]
11914 "TARGET_POWER"
11915 "@
11916 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
11917 #"
11918 [(set_attr "type" "compare")
11919 (set_attr "length" "12,16")])
11920
11921 (define_split
11922 [(set (match_operand:CC 5 "cc_reg_not_cr0_operand" "")
11923 (compare:CC
11924 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
11925 (match_operand:SI 2 "reg_or_short_operand" ""))
11926 (match_operand:SI 3 "gpc_reg_operand" ""))
11927 (const_int 0)))
11928 (set (match_operand:SI 0 "gpc_reg_operand" "")
11929 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11930 (clobber (match_scratch:SI 4 ""))]
11931 "TARGET_POWER && reload_completed"
11932 [(parallel [(set (match_dup 0)
11933 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11934 (clobber (match_dup 4))])
11935 (set (match_dup 5)
11936 (compare:CC (match_dup 0)
11937 (const_int 0)))]
11938 "")
11939
11940 (define_insn ""
11941 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11942 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11943 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
11944 "TARGET_POWER"
11945 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
11946 [(set_attr "length" "12")])
11947
11948 (define_insn ""
11949 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11950 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11951 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
11952 "! TARGET_POWERPC64"
11953 "@
11954 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
11955 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
11956 [(set_attr "length" "12")])
11957
11958 (define_insn ""
11959 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11960 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
11961 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P")))]
11962 "TARGET_POWERPC64"
11963 "@
11964 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
11965 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
11966 [(set_attr "length" "12")])
11967
11968 (define_insn ""
11969 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
11970 (compare:CC
11971 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11972 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
11973 (const_int 0)))
11974 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
11975 (geu:SI (match_dup 1) (match_dup 2)))]
11976 "! TARGET_POWERPC64"
11977 "@
11978 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
11979 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
11980 #
11981 #"
11982 [(set_attr "type" "compare")
11983 (set_attr "length" "12,12,16,16")])
11984
11985 (define_split
11986 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
11987 (compare:CC
11988 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11989 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
11990 (const_int 0)))
11991 (set (match_operand:SI 0 "gpc_reg_operand" "")
11992 (geu:SI (match_dup 1) (match_dup 2)))]
11993 "! TARGET_POWERPC64 && reload_completed"
11994 [(set (match_dup 0)
11995 (geu:SI (match_dup 1) (match_dup 2)))
11996 (set (match_dup 3)
11997 (compare:CC (match_dup 0)
11998 (const_int 0)))]
11999 "")
12000
12001 (define_insn ""
12002 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12003 (compare:CC
12004 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
12005 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12006 (const_int 0)))
12007 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
12008 (geu:DI (match_dup 1) (match_dup 2)))]
12009 "TARGET_POWERPC64"
12010 "@
12011 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
12012 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
12013 #
12014 #"
12015 [(set_attr "type" "compare")
12016 (set_attr "length" "12,12,16,16")])
12017
12018 (define_split
12019 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12020 (compare:CC
12021 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12022 (match_operand:DI 2 "reg_or_neg_short_operand" ""))
12023 (const_int 0)))
12024 (set (match_operand:DI 0 "gpc_reg_operand" "")
12025 (geu:DI (match_dup 1) (match_dup 2)))]
12026 "TARGET_POWERPC64 && reload_completed"
12027 [(set (match_dup 0)
12028 (geu:DI (match_dup 1) (match_dup 2)))
12029 (set (match_dup 3)
12030 (compare:CC (match_dup 0)
12031 (const_int 0)))]
12032 "")
12033
12034 (define_insn ""
12035 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12036 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12037 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12038 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12039 "! TARGET_POWERPC64"
12040 "@
12041 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
12042 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
12043 [(set_attr "length" "8")])
12044
12045 (define_insn ""
12046 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12047 (compare:CC
12048 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12049 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12050 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12051 (const_int 0)))
12052 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12053 "! TARGET_POWERPC64"
12054 "@
12055 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
12056 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
12057 #
12058 #"
12059 [(set_attr "type" "compare")
12060 (set_attr "length" "8,8,12,12")])
12061
12062 (define_split
12063 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12064 (compare:CC
12065 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12066 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12067 (match_operand:SI 3 "gpc_reg_operand" ""))
12068 (const_int 0)))
12069 (clobber (match_scratch:SI 4 ""))]
12070 "! TARGET_POWERPC64 && reload_completed"
12071 [(set (match_dup 4)
12072 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
12073 (match_dup 3)))
12074 (set (match_dup 0)
12075 (compare:CC (match_dup 4)
12076 (const_int 0)))]
12077 "")
12078
12079 (define_insn ""
12080 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,?y,?y")
12081 (compare:CC
12082 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12083 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12084 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12085 (const_int 0)))
12086 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12087 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12088 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12089 "! TARGET_POWERPC64"
12090 "@
12091 {sf|subfc} %4,%2,%1\;{aze.|addze.} %0,%3
12092 {ai|addic} %4,%1,%n2\;{aze.|addze.} %0,%3
12093 #
12094 #"
12095 [(set_attr "type" "compare")
12096 (set_attr "length" "8,8,12,12")])
12097
12098 (define_split
12099 [(set (match_operand:CC 5 "cc_reg_not_cr0_operand" "")
12100 (compare:CC
12101 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12102 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12103 (match_operand:SI 3 "gpc_reg_operand" ""))
12104 (const_int 0)))
12105 (set (match_operand:SI 0 "gpc_reg_operand" "")
12106 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12107 (clobber (match_scratch:SI 4 ""))]
12108 "! TARGET_POWERPC64 && reload_completed"
12109 [(parallel [(set (match_dup 0)
12110 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12111 (clobber (match_dup 4))])
12112 (set (match_dup 5)
12113 (compare:CC (match_dup 0)
12114 (const_int 0)))]
12115 "")
12116
12117 (define_insn ""
12118 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12119 (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12120 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
12121 "! TARGET_POWERPC64"
12122 "@
12123 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
12124 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
12125 [(set_attr "length" "12")])
12126
12127 (define_insn ""
12128 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12129 (and:SI (neg:SI
12130 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12131 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
12132 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
12133 (clobber (match_scratch:SI 4 "=&r,&r"))]
12134 "! TARGET_POWERPC64"
12135 "@
12136 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4
12137 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4"
12138 [(set_attr "length" "12")])
12139
12140 (define_insn ""
12141 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12142 (compare:CC
12143 (and:SI (neg:SI
12144 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12145 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12146 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12147 (const_int 0)))
12148 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12149 "! TARGET_POWERPC64"
12150 "@
12151 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12152 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12153 #
12154 #"
12155 [(set_attr "type" "compare")
12156 (set_attr "length" "12,12,16,16")])
12157
12158 (define_split
12159 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12160 (compare:CC
12161 (and:SI (neg:SI
12162 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12163 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12164 (match_operand:SI 3 "gpc_reg_operand" ""))
12165 (const_int 0)))
12166 (clobber (match_scratch:SI 4 ""))]
12167 "! TARGET_POWERPC64 && reload_completed"
12168 [(set (match_dup 4)
12169 (and:SI (neg:SI (geu:SI (match_dup 1)
12170 (match_dup 2)))
12171 (match_dup 3)))
12172 (set (match_dup 0)
12173 (compare:CC (match_dup 4)
12174 (const_int 0)))]
12175 "")
12176
12177 (define_insn ""
12178 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,?y,?y")
12179 (compare:CC
12180 (and:SI (neg:SI
12181 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12182 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12183 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12184 (const_int 0)))
12185 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12186 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
12187 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12188 "! TARGET_POWERPC64"
12189 "@
12190 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4
12191 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4
12192 #
12193 #"
12194 [(set_attr "type" "compare")
12195 (set_attr "length" "12,12,16,16")])
12196
12197 (define_split
12198 [(set (match_operand:CC 5 "cc_reg_not_cr0_operand" "")
12199 (compare:CC
12200 (and:SI (neg:SI
12201 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12202 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12203 (match_operand:SI 3 "gpc_reg_operand" ""))
12204 (const_int 0)))
12205 (set (match_operand:SI 0 "gpc_reg_operand" "")
12206 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
12207 (clobber (match_scratch:SI 4 ""))]
12208 "! TARGET_POWERPC64 && reload_completed"
12209 [(parallel [(set (match_dup 0)
12210 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
12211 (clobber (match_dup 4))])
12212 (set (match_dup 5)
12213 (compare:CC (match_dup 0)
12214 (const_int 0)))]
12215 "")
12216
12217 (define_insn ""
12218 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12219 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12220 (const_int 0)))]
12221 "! TARGET_POWERPC64"
12222 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31"
12223 [(set_attr "length" "12")])
12224
12225 (define_insn ""
12226 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12227 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12228 (const_int 0)))]
12229 "TARGET_POWERPC64"
12230 "subfic %0,%1,0\;addme %0,%0\;srdi %0,%0,63"
12231 [(set_attr "length" "12")])
12232
12233 (define_insn ""
12234 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
12235 (compare:CC
12236 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12237 (const_int 0))
12238 (const_int 0)))
12239 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12240 (gt:SI (match_dup 1) (const_int 0)))]
12241 "! TARGET_POWERPC64"
12242 "@
12243 {sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri.|srwi.} %0,%0,31
12244 #"
12245 [(set_attr "type" "delayed_compare")
12246 (set_attr "length" "12,16")])
12247
12248 (define_split
12249 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
12250 (compare:CC
12251 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12252 (const_int 0))
12253 (const_int 0)))
12254 (set (match_operand:SI 0 "gpc_reg_operand" "")
12255 (gt:SI (match_dup 1) (const_int 0)))]
12256 "! TARGET_POWERPC64 && reload_completed"
12257 [(set (match_dup 0)
12258 (gt:SI (match_dup 1) (const_int 0)))
12259 (set (match_dup 2)
12260 (compare:CC (match_dup 0)
12261 (const_int 0)))]
12262 "")
12263
12264 (define_insn ""
12265 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
12266 (compare:CC
12267 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12268 (const_int 0))
12269 (const_int 0)))
12270 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12271 (gt:DI (match_dup 1) (const_int 0)))]
12272 "TARGET_POWERPC64"
12273 "@
12274 subfic %0,%1,0\;addme %0,%0\;srdi. %0,%0,63
12275 #"
12276 [(set_attr "type" "delayed_compare")
12277 (set_attr "length" "12,16")])
12278
12279 (define_split
12280 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
12281 (compare:CC
12282 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12283 (const_int 0))
12284 (const_int 0)))
12285 (set (match_operand:DI 0 "gpc_reg_operand" "")
12286 (gt:DI (match_dup 1) (const_int 0)))]
12287 "TARGET_POWERPC64 && reload_completed"
12288 [(set (match_dup 0)
12289 (gt:DI (match_dup 1) (const_int 0)))
12290 (set (match_dup 2)
12291 (compare:CC (match_dup 0)
12292 (const_int 0)))]
12293 "")
12294
12295 (define_insn ""
12296 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12297 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12298 (match_operand:SI 2 "reg_or_short_operand" "r")))]
12299 "TARGET_POWER"
12300 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12301 [(set_attr "length" "12")])
12302
12303 (define_insn ""
12304 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12305 (compare:CC
12306 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12307 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
12308 (const_int 0)))
12309 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12310 (gt:SI (match_dup 1) (match_dup 2)))]
12311 "TARGET_POWER"
12312 "@
12313 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12314 #"
12315 [(set_attr "type" "delayed_compare")
12316 (set_attr "length" "12,16")])
12317
12318 (define_split
12319 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12320 (compare:CC
12321 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12322 (match_operand:SI 2 "reg_or_short_operand" ""))
12323 (const_int 0)))
12324 (set (match_operand:SI 0 "gpc_reg_operand" "")
12325 (gt:SI (match_dup 1) (match_dup 2)))]
12326 "TARGET_POWER && reload_completed"
12327 [(set (match_dup 0)
12328 (gt:SI (match_dup 1) (match_dup 2)))
12329 (set (match_dup 3)
12330 (compare:CC (match_dup 0)
12331 (const_int 0)))]
12332 "")
12333
12334 (define_insn ""
12335 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12336 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12337 (const_int 0))
12338 (match_operand:SI 2 "gpc_reg_operand" "r")))]
12339 "! TARGET_POWERPC64"
12340 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
12341 [(set_attr "length" "12")])
12342
12343 (define_insn ""
12344 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12345 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12346 (const_int 0))
12347 (match_operand:DI 2 "gpc_reg_operand" "r")))
12348 (clobber (match_scratch:DI 3 "=&r"))]
12349 "TARGET_POWERPC64"
12350 "addc %3,%1,%1\;subfe %3,%1,%3\;addze %0,%2"
12351 [(set_attr "length" "12")])
12352
12353 (define_insn ""
12354 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12355 (compare:CC
12356 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12357 (const_int 0))
12358 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12359 (const_int 0)))
12360 (clobber (match_scratch:SI 3 "=&r,&r"))]
12361 "! TARGET_POWERPC64"
12362 "@
12363 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
12364 #"
12365 [(set_attr "type" "compare")
12366 (set_attr "length" "12,16")])
12367
12368 (define_split
12369 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12370 (compare:CC
12371 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12372 (const_int 0))
12373 (match_operand:SI 2 "gpc_reg_operand" ""))
12374 (const_int 0)))
12375 (clobber (match_scratch:SI 3 ""))]
12376 "! TARGET_POWERPC64 && reload_completed"
12377 [(set (match_dup 3)
12378 (plus:SI (gt:SI (match_dup 1) (const_int 0))
12379 (match_dup 2)))
12380 (set (match_dup 0)
12381 (compare:CC (match_dup 3)
12382 (const_int 0)))]
12383 "")
12384
12385 (define_insn ""
12386 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12387 (compare:CC
12388 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12389 (const_int 0))
12390 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12391 (const_int 0)))
12392 (clobber (match_scratch:DI 3 "=&r,&r"))]
12393 "TARGET_POWERPC64"
12394 "@
12395 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
12396 #"
12397 [(set_attr "type" "compare")
12398 (set_attr "length" "12,16")])
12399
12400 (define_split
12401 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12402 (compare:CC
12403 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12404 (const_int 0))
12405 (match_operand:DI 2 "gpc_reg_operand" ""))
12406 (const_int 0)))
12407 (clobber (match_scratch:DI 3 ""))]
12408 "TARGET_POWERPC64 && reload_completed"
12409 [(set (match_dup 3)
12410 (plus:DI (gt:DI (match_dup 1) (const_int 0))
12411 (match_dup 2)))
12412 (set (match_dup 0)
12413 (compare:CC (match_dup 3)
12414 (const_int 0)))]
12415 "")
12416
12417 (define_insn ""
12418 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12419 (compare:CC
12420 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12421 (const_int 0))
12422 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12423 (const_int 0)))
12424 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12425 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
12426 (clobber (match_scratch:SI 3 "=&r,&r"))]
12427 "! TARGET_POWERPC64"
12428 "@
12429 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %0,%2
12430 #"
12431 [(set_attr "type" "compare")
12432 (set_attr "length" "12,16")])
12433
12434 (define_split
12435 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12436 (compare:CC
12437 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12438 (const_int 0))
12439 (match_operand:SI 2 "gpc_reg_operand" ""))
12440 (const_int 0)))
12441 (set (match_operand:SI 0 "gpc_reg_operand" "")
12442 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
12443 (clobber (match_scratch:SI 3 ""))]
12444 "! TARGET_POWERPC64 && reload_completed"
12445 [(parallel [(set (match_dup 0)
12446 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
12447 (clobber (match_dup 3))])
12448 (set (match_dup 4)
12449 (compare:CC (match_dup 0)
12450 (const_int 0)))]
12451 "")
12452
12453 (define_insn ""
12454 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12455 (compare:CC
12456 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12457 (const_int 0))
12458 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12459 (const_int 0)))
12460 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12461 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
12462 (clobber (match_scratch:DI 3 "=&r,&r"))]
12463 "TARGET_POWERPC64"
12464 "@
12465 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %0,%2
12466 #"
12467 [(set_attr "type" "compare")
12468 (set_attr "length" "12,16")])
12469
12470 (define_split
12471 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12472 (compare:CC
12473 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12474 (const_int 0))
12475 (match_operand:DI 2 "gpc_reg_operand" ""))
12476 (const_int 0)))
12477 (set (match_operand:DI 0 "gpc_reg_operand" "")
12478 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
12479 (clobber (match_scratch:DI 3 ""))]
12480 "TARGET_POWERPC64 && reload_completed"
12481 [(parallel [(set (match_dup 0)
12482 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
12483 (clobber (match_dup 3))])
12484 (set (match_dup 4)
12485 (compare:CC (match_dup 0)
12486 (const_int 0)))]
12487 "")
12488
12489 (define_insn ""
12490 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12491 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12492 (match_operand:SI 2 "reg_or_short_operand" "r"))
12493 (match_operand:SI 3 "gpc_reg_operand" "r")))
12494 (clobber (match_scratch:SI 4 "=&r"))]
12495 "TARGET_POWER"
12496 "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze|addze} %0,%3"
12497 [(set_attr "length" "12")])
12498
12499 (define_insn ""
12500 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12501 (compare:CC
12502 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12503 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
12504 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12505 (const_int 0)))
12506 (clobber (match_scratch:SI 4 "=&r,&r"))]
12507 "TARGET_POWER"
12508 "@
12509 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
12510 #"
12511 [(set_attr "type" "compare")
12512 (set_attr "length" "12,16")])
12513
12514 (define_split
12515 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12516 (compare:CC
12517 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12518 (match_operand:SI 2 "reg_or_short_operand" ""))
12519 (match_operand:SI 3 "gpc_reg_operand" ""))
12520 (const_int 0)))
12521 (clobber (match_scratch:SI 4 ""))]
12522 "TARGET_POWER && reload_completed"
12523 [(set (match_dup 4)
12524 (plus:SI (gt:SI (match_dup 1) (match_dup 2))
12525 (match_dup 3)))
12526 (set (match_dup 0)
12527 (compare:CC (match_dup 4)
12528 (const_int 0)))]
12529 "")
12530
12531 (define_insn ""
12532 [(set (match_operand:CC 5 "cc_reg_operand" "=x,?y")
12533 (compare:CC
12534 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12535 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
12536 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12537 (const_int 0)))
12538 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12539 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12540 (clobber (match_scratch:SI 4 "=&r,&r"))]
12541 "TARGET_POWER"
12542 "@
12543 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %0,%3
12544 #"
12545 [(set_attr "type" "compare")
12546 (set_attr "length" "12,16")])
12547
12548 (define_split
12549 [(set (match_operand:CC 5 "cc_reg_not_cr0_operand" "")
12550 (compare:CC
12551 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12552 (match_operand:SI 2 "reg_or_short_operand" ""))
12553 (match_operand:SI 3 "gpc_reg_operand" ""))
12554 (const_int 0)))
12555 (set (match_operand:SI 0 "gpc_reg_operand" "")
12556 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12557 (clobber (match_scratch:SI 4 ""))]
12558 "TARGET_POWER && reload_completed"
12559 [(parallel [(set (match_dup 0)
12560 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12561 (clobber (match_dup 4))])
12562 (set (match_dup 5)
12563 (compare:CC (match_dup 0)
12564 (const_int 0)))]
12565 "")
12566
12567 (define_insn ""
12568 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12569 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12570 (const_int 0))))]
12571 "! TARGET_POWERPC64"
12572 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{srai|srawi} %0,%0,31"
12573 [(set_attr "length" "12")])
12574
12575 (define_insn ""
12576 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12577 (neg:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12578 (const_int 0))))]
12579 "TARGET_POWERPC64"
12580 "subfic %0,%1,0\;addme %0,%0\;sradi %0,%0,63"
12581 [(set_attr "length" "12")])
12582
12583 (define_insn ""
12584 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12585 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12586 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
12587 "TARGET_POWER"
12588 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
12589 [(set_attr "length" "12")])
12590
12591 (define_insn ""
12592 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12593 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12594 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12595 "! TARGET_POWERPC64"
12596 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
12597 [(set_attr "length" "12")])
12598
12599 (define_insn ""
12600 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12601 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12602 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
12603 "TARGET_POWERPC64"
12604 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;neg %0,%0"
12605 [(set_attr "length" "12")])
12606
12607 (define_insn ""
12608 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12609 (compare:CC
12610 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12611 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12612 (const_int 0)))
12613 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12614 (gtu:SI (match_dup 1) (match_dup 2)))]
12615 "! TARGET_POWERPC64"
12616 "@
12617 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12618 #"
12619 [(set_attr "type" "compare")
12620 (set_attr "length" "12,16")])
12621
12622 (define_split
12623 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12624 (compare:CC
12625 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12626 (match_operand:SI 2 "reg_or_short_operand" ""))
12627 (const_int 0)))
12628 (set (match_operand:SI 0 "gpc_reg_operand" "")
12629 (gtu:SI (match_dup 1) (match_dup 2)))]
12630 "! TARGET_POWERPC64 && reload_completed"
12631 [(set (match_dup 0)
12632 (gtu:SI (match_dup 1) (match_dup 2)))
12633 (set (match_dup 3)
12634 (compare:CC (match_dup 0)
12635 (const_int 0)))]
12636 "")
12637
12638 (define_insn ""
12639 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12640 (compare:CC
12641 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12642 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
12643 (const_int 0)))
12644 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12645 (gtu:DI (match_dup 1) (match_dup 2)))]
12646 "TARGET_POWERPC64"
12647 "@
12648 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;neg. %0,%0
12649 #"
12650 [(set_attr "type" "compare")
12651 (set_attr "length" "12,16")])
12652
12653 (define_split
12654 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12655 (compare:CC
12656 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12657 (match_operand:DI 2 "reg_or_short_operand" ""))
12658 (const_int 0)))
12659 (set (match_operand:DI 0 "gpc_reg_operand" "")
12660 (gtu:DI (match_dup 1) (match_dup 2)))]
12661 "TARGET_POWERPC64 && reload_completed"
12662 [(set (match_dup 0)
12663 (gtu:DI (match_dup 1) (match_dup 2)))
12664 (set (match_dup 3)
12665 (compare:CC (match_dup 0)
12666 (const_int 0)))]
12667 "")
12668
12669 (define_insn ""
12670 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12671 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12672 (match_operand:SI 2 "reg_or_short_operand" "I,rI"))
12673 (match_operand:SI 3 "reg_or_short_operand" "r,rI")))]
12674 "! TARGET_POWERPC64"
12675 "@
12676 {ai|addic} %0,%1,%k2\;{aze|addze} %0,%3
12677 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3"
12678 [(set_attr "length" "8,12")])
12679
12680 (define_insn ""
12681 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12682 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12683 (match_operand:DI 2 "reg_or_short_operand" "I,rI"))
12684 (match_operand:DI 3 "reg_or_short_operand" "r,rI")))
12685 (clobber (match_scratch:DI 4 "=&r,&r"))]
12686 "TARGET_POWERPC64"
12687 "@
12688 addic %4,%1,%k2\;addze %0,%3
12689 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;subf%I3c %0,%4,%3"
12690 [(set_attr "length" "8,12")])
12691
12692 (define_insn ""
12693 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12694 (compare:CC
12695 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12696 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
12697 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12698 (const_int 0)))
12699 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12700 "! TARGET_POWERPC64"
12701 "@
12702 {ai|addic} %4,%1,%k2\;{aze.|addze.} %4,%3
12703 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
12704 #
12705 #"
12706 [(set_attr "type" "compare")
12707 (set_attr "length" "8,12,12,16")])
12708
12709 (define_split
12710 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12711 (compare:CC
12712 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12713 (match_operand:SI 2 "reg_or_short_operand" ""))
12714 (match_operand:SI 3 "gpc_reg_operand" ""))
12715 (const_int 0)))
12716 (clobber (match_scratch:SI 4 ""))]
12717 "! TARGET_POWERPC64 && reload_completed"
12718 [(set (match_dup 4)
12719 (plus:SI (gtu:SI (match_dup 1) (match_dup 2))
12720 (match_dup 3)))
12721 (set (match_dup 0)
12722 (compare:CC (match_dup 4)
12723 (const_int 0)))]
12724 "")
12725
12726 (define_insn ""
12727 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12728 (compare:CC
12729 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
12730 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
12731 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
12732 (const_int 0)))
12733 (clobber (match_scratch:DI 4 "=&r,&r,&r,&r"))]
12734 "TARGET_POWERPC64"
12735 "@
12736 addic %4,%1,%k2\;addze. %4,%3
12737 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;subfc. %4,%4,%3
12738 #
12739 #"
12740 [(set_attr "type" "compare")
12741 (set_attr "length" "8,12,12,16")])
12742
12743 (define_split
12744 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12745 (compare:CC
12746 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12747 (match_operand:DI 2 "reg_or_short_operand" ""))
12748 (match_operand:DI 3 "gpc_reg_operand" ""))
12749 (const_int 0)))
12750 (clobber (match_scratch:DI 4 ""))]
12751 "TARGET_POWERPC64 && reload_completed"
12752 [(set (match_dup 4)
12753 (plus:DI (gtu:DI (match_dup 1) (match_dup 2))
12754 (match_dup 3)))
12755 (set (match_dup 0)
12756 (compare:CC (match_dup 4)
12757 (const_int 0)))]
12758 "")
12759
12760 (define_insn ""
12761 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,?y,?y")
12762 (compare:CC
12763 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12764 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
12765 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12766 (const_int 0)))
12767 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12768 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12769 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12770 "! TARGET_POWERPC64"
12771 "@
12772 {ai|addic} %4,%1,%k2\;{aze.|addze.} %0,%3
12773 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3
12774 #
12775 #"
12776 [(set_attr "type" "compare")
12777 (set_attr "length" "8,12,12,16")])
12778
12779 (define_split
12780 [(set (match_operand:CC 5 "cc_reg_not_cr0_operand" "")
12781 (compare:CC
12782 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12783 (match_operand:SI 2 "reg_or_short_operand" ""))
12784 (match_operand:SI 3 "gpc_reg_operand" ""))
12785 (const_int 0)))
12786 (set (match_operand:SI 0 "gpc_reg_operand" "")
12787 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12788 (clobber (match_scratch:SI 4 ""))]
12789 "! TARGET_POWERPC64 && reload_completed"
12790 [(parallel [(set (match_dup 0)
12791 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12792 (clobber (match_dup 4))])
12793 (set (match_dup 5)
12794 (compare:CC (match_dup 0)
12795 (const_int 0)))]
12796 "")
12797
12798 (define_insn ""
12799 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,?y,?y")
12800 (compare:CC
12801 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
12802 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
12803 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
12804 (const_int 0)))
12805 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
12806 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
12807 (clobber (match_scratch:DI 4 "=&r,&r,&r,&r"))]
12808 "TARGET_POWERPC64"
12809 "@
12810 addic %4,%1,%k2\;addze. %0,%3
12811 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;subfc. %0,%4,%3
12812 #
12813 #"
12814 [(set_attr "type" "compare")
12815 (set_attr "length" "8,12,12,16")])
12816
12817 (define_split
12818 [(set (match_operand:CC 5 "cc_reg_not_cr0_operand" "")
12819 (compare:CC
12820 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12821 (match_operand:DI 2 "reg_or_short_operand" ""))
12822 (match_operand:DI 3 "gpc_reg_operand" ""))
12823 (const_int 0)))
12824 (set (match_operand:DI 0 "gpc_reg_operand" "")
12825 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
12826 (clobber (match_scratch:DI 4 ""))]
12827 "TARGET_POWERPC64 && reload_completed"
12828 [(parallel [(set (match_dup 0)
12829 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
12830 (clobber (match_dup 4))])
12831 (set (match_dup 5)
12832 (compare:CC (match_dup 0)
12833 (const_int 0)))]
12834 "")
12835
12836 (define_insn ""
12837 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12838 (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12839 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12840 "! TARGET_POWERPC64"
12841 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
12842 [(set_attr "length" "8")])
12843
12844 (define_insn ""
12845 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12846 (neg:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12847 (match_operand:DI 2 "reg_or_short_operand" "rI"))))]
12848 "TARGET_POWERPC64"
12849 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
12850 [(set_attr "length" "8")])
12851 \f
12852 ;; Define both directions of branch and return. If we need a reload
12853 ;; register, we'd rather use CR0 since it is much easier to copy a
12854 ;; register CC value to there.
12855
12856 (define_insn ""
12857 [(set (pc)
12858 (if_then_else (match_operator 1 "branch_comparison_operator"
12859 [(match_operand 2
12860 "cc_reg_operand" "x,?y")
12861 (const_int 0)])
12862 (label_ref (match_operand 0 "" ""))
12863 (pc)))]
12864 ""
12865 "*
12866 {
12867 return output_cbranch (operands[1], \"%l0\", 0, insn);
12868 }"
12869 [(set_attr "type" "branch")])
12870
12871 (define_insn ""
12872 [(set (pc)
12873 (if_then_else (match_operator 0 "branch_comparison_operator"
12874 [(match_operand 1
12875 "cc_reg_operand" "x,?y")
12876 (const_int 0)])
12877 (return)
12878 (pc)))]
12879 "direct_return ()"
12880 "*
12881 {
12882 return output_cbranch (operands[0], NULL, 0, insn);
12883 }"
12884 [(set_attr "type" "branch")
12885 (set_attr "length" "4")])
12886
12887 (define_insn ""
12888 [(set (pc)
12889 (if_then_else (match_operator 1 "branch_comparison_operator"
12890 [(match_operand 2
12891 "cc_reg_operand" "x,?y")
12892 (const_int 0)])
12893 (pc)
12894 (label_ref (match_operand 0 "" ""))))]
12895 ""
12896 "*
12897 {
12898 return output_cbranch (operands[1], \"%l0\", 1, insn);
12899 }"
12900 [(set_attr "type" "branch")])
12901
12902 (define_insn ""
12903 [(set (pc)
12904 (if_then_else (match_operator 0 "branch_comparison_operator"
12905 [(match_operand 1
12906 "cc_reg_operand" "x,?y")
12907 (const_int 0)])
12908 (pc)
12909 (return)))]
12910 "direct_return ()"
12911 "*
12912 {
12913 return output_cbranch (operands[0], NULL, 1, insn);
12914 }"
12915 [(set_attr "type" "branch")
12916 (set_attr "length" "4")])
12917
12918 ;; Logic on condition register values.
12919
12920 ; This pattern matches things like
12921 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
12922 ; (eq:SI (reg:CCFP 68) (const_int 0)))
12923 ; (const_int 1)))
12924 ; which are generated by the branch logic.
12925
12926 (define_insn ""
12927 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
12928 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
12929 [(match_operator:SI 2
12930 "branch_positive_comparison_operator"
12931 [(match_operand 3
12932 "cc_reg_operand" "y")
12933 (const_int 0)])
12934 (match_operator:SI 4
12935 "branch_positive_comparison_operator"
12936 [(match_operand 5
12937 "cc_reg_operand" "y")
12938 (const_int 0)])])
12939 (const_int 1)))]
12940 ""
12941 "cr%q1 %E0,%j2,%j4"
12942 [(set_attr "type" "cr_logical")])
12943
12944 ; Why is the constant -1 here, but 1 in the previous pattern?
12945 ; Because ~1 has all but the low bit set.
12946 (define_insn ""
12947 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
12948 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
12949 [(not:SI (match_operator:SI 2
12950 "branch_positive_comparison_operator"
12951 [(match_operand 3
12952 "cc_reg_operand" "y")
12953 (const_int 0)]))
12954 (match_operator:SI 4
12955 "branch_positive_comparison_operator"
12956 [(match_operand 5
12957 "cc_reg_operand" "y")
12958 (const_int 0)])])
12959 (const_int -1)))]
12960 ""
12961 "cr%q1 %E0,%j2,%j4"
12962 [(set_attr "type" "cr_logical")])
12963
12964 (define_insn ""
12965 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
12966 (compare:CCEQ (match_operator:SI 1
12967 "branch_positive_comparison_operator"
12968 [(match_operand 2
12969 "cc_reg_operand" "y")
12970 (const_int 0)])
12971 (const_int 0)))]
12972 ""
12973 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
12974 [(set_attr "type" "cr_logical")])
12975
12976 ;; If we are comparing the result of two comparisons, this can be done
12977 ;; using creqv or crxor.
12978
12979 (define_insn_and_split ""
12980 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
12981 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
12982 [(match_operand 2 "cc_reg_operand" "y")
12983 (const_int 0)])
12984 (match_operator 3 "branch_comparison_operator"
12985 [(match_operand 4 "cc_reg_operand" "y")
12986 (const_int 0)])))]
12987 ""
12988 "#"
12989 ""
12990 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
12991 (match_dup 5)))]
12992 "
12993 {
12994 int positive_1, positive_2;
12995
12996 positive_1 = branch_positive_comparison_operator (operands[1], CCEQmode);
12997 positive_2 = branch_positive_comparison_operator (operands[3], CCEQmode);
12998
12999 if (! positive_1)
13000 operands[1] = gen_rtx (rs6000_reverse_condition (GET_MODE (operands[2]),
13001 GET_CODE (operands[1])),
13002 SImode,
13003 operands[2], const0_rtx);
13004 else if (GET_MODE (operands[1]) != SImode)
13005 operands[1] = gen_rtx (GET_CODE (operands[1]),
13006 SImode,
13007 operands[2], const0_rtx);
13008
13009 if (! positive_2)
13010 operands[3] = gen_rtx (rs6000_reverse_condition (GET_MODE (operands[4]),
13011 GET_CODE (operands[3])),
13012 SImode,
13013 operands[4], const0_rtx);
13014 else if (GET_MODE (operands[3]) != SImode)
13015 operands[3] = gen_rtx (GET_CODE (operands[3]),
13016 SImode,
13017 operands[4], const0_rtx);
13018
13019 if (positive_1 == positive_2)
13020 {
13021 operands[1] = gen_rtx_NOT (SImode, operands[1]);
13022 operands[5] = constm1_rtx;
13023 }
13024 else
13025 {
13026 operands[5] = const1_rtx;
13027 }
13028 }")
13029
13030 ;; Unconditional branch and return.
13031
13032 (define_insn "jump"
13033 [(set (pc)
13034 (label_ref (match_operand 0 "" "")))]
13035 ""
13036 "b %l0"
13037 [(set_attr "type" "branch")])
13038
13039 (define_insn "return"
13040 [(return)]
13041 "direct_return ()"
13042 "{br|blr}"
13043 [(set_attr "type" "jmpreg")])
13044
13045 (define_expand "indirect_jump"
13046 [(set (pc) (match_operand 0 "register_operand" ""))]
13047 ""
13048 "
13049 {
13050 if (TARGET_32BIT)
13051 emit_jump_insn (gen_indirect_jumpsi (operands[0]));
13052 else
13053 emit_jump_insn (gen_indirect_jumpdi (operands[0]));
13054 DONE;
13055 }")
13056
13057 (define_insn "indirect_jumpsi"
13058 [(set (pc) (match_operand:SI 0 "register_operand" "c,*l"))]
13059 "TARGET_32BIT"
13060 "@
13061 bctr
13062 {br|blr}"
13063 [(set_attr "type" "jmpreg")])
13064
13065 (define_insn "indirect_jumpdi"
13066 [(set (pc) (match_operand:DI 0 "register_operand" "c,*l"))]
13067 "TARGET_64BIT"
13068 "@
13069 bctr
13070 blr"
13071 [(set_attr "type" "jmpreg")])
13072
13073 ;; Table jump for switch statements:
13074 (define_expand "tablejump"
13075 [(use (match_operand 0 "" ""))
13076 (use (label_ref (match_operand 1 "" "")))]
13077 ""
13078 "
13079 {
13080 if (TARGET_32BIT)
13081 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
13082 else
13083 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
13084 DONE;
13085 }")
13086
13087 (define_expand "tablejumpsi"
13088 [(set (match_dup 3)
13089 (plus:SI (match_operand:SI 0 "" "")
13090 (match_dup 2)))
13091 (parallel [(set (pc) (match_dup 3))
13092 (use (label_ref (match_operand 1 "" "")))])]
13093 "TARGET_32BIT"
13094 "
13095 { operands[0] = force_reg (SImode, operands[0]);
13096 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
13097 operands[3] = gen_reg_rtx (SImode);
13098 }")
13099
13100 (define_expand "tablejumpdi"
13101 [(set (match_dup 4)
13102 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "rm")))
13103 (set (match_dup 3)
13104 (plus:DI (match_dup 4)
13105 (match_dup 2)))
13106 (parallel [(set (pc) (match_dup 3))
13107 (use (label_ref (match_operand 1 "" "")))])]
13108 "TARGET_64BIT"
13109 "
13110 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
13111 operands[3] = gen_reg_rtx (DImode);
13112 operands[4] = gen_reg_rtx (DImode);
13113 }")
13114
13115 (define_insn ""
13116 [(set (pc)
13117 (match_operand:SI 0 "register_operand" "c,*l"))
13118 (use (label_ref (match_operand 1 "" "")))]
13119 "TARGET_32BIT"
13120 "@
13121 bctr
13122 {br|blr}"
13123 [(set_attr "type" "jmpreg")])
13124
13125 (define_insn ""
13126 [(set (pc)
13127 (match_operand:DI 0 "register_operand" "c,*l"))
13128 (use (label_ref (match_operand 1 "" "")))]
13129 "TARGET_64BIT"
13130 "@
13131 bctr
13132 blr"
13133 [(set_attr "type" "jmpreg")])
13134
13135 (define_insn "nop"
13136 [(const_int 0)]
13137 ""
13138 "{cror 0,0,0|nop}")
13139 \f
13140 ;; Define the subtract-one-and-jump insns, starting with the template
13141 ;; so loop.c knows what to generate.
13142
13143 (define_expand "doloop_end"
13144 [(use (match_operand 0 "" "")) ; loop pseudo
13145 (use (match_operand 1 "" "")) ; iterations; zero if unknown
13146 (use (match_operand 2 "" "")) ; max iterations
13147 (use (match_operand 3 "" "")) ; loop level
13148 (use (match_operand 4 "" ""))] ; label
13149 ""
13150 "
13151 {
13152 /* Only use this on innermost loops. */
13153 if (INTVAL (operands[3]) > 1)
13154 FAIL;
13155 if (TARGET_POWERPC64)
13156 {
13157 if (GET_MODE (operands[0]) != DImode)
13158 FAIL;
13159 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
13160 }
13161 else
13162 {
13163 if (GET_MODE (operands[0]) != SImode)
13164 FAIL;
13165 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
13166 }
13167 DONE;
13168 }")
13169
13170 (define_expand "ctrsi"
13171 [(parallel [(set (pc)
13172 (if_then_else (ne (match_operand:SI 0 "register_operand" "")
13173 (const_int 1))
13174 (label_ref (match_operand 1 "" ""))
13175 (pc)))
13176 (set (match_dup 0)
13177 (plus:SI (match_dup 0)
13178 (const_int -1)))
13179 (clobber (match_scratch:CC 2 ""))
13180 (clobber (match_scratch:SI 3 ""))])]
13181 "! TARGET_POWERPC64"
13182 "")
13183
13184 (define_expand "ctrdi"
13185 [(parallel [(set (pc)
13186 (if_then_else (ne (match_operand:DI 0 "register_operand" "")
13187 (const_int 1))
13188 (label_ref (match_operand 1 "" ""))
13189 (pc)))
13190 (set (match_dup 0)
13191 (plus:DI (match_dup 0)
13192 (const_int -1)))
13193 (clobber (match_scratch:CC 2 ""))
13194 (clobber (match_scratch:DI 3 ""))])]
13195 "TARGET_POWERPC64"
13196 "")
13197
13198 ;; We need to be able to do this for any operand, including MEM, or we
13199 ;; will cause reload to blow up since we don't allow output reloads on
13200 ;; JUMP_INSNs.
13201 ;; For the length attribute to be calculated correctly, the
13202 ;; label MUST be operand 0.
13203
13204 (define_insn "*ctrsi_internal1"
13205 [(set (pc)
13206 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r")
13207 (const_int 1))
13208 (label_ref (match_operand 0 "" ""))
13209 (pc)))
13210 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
13211 (plus:SI (match_dup 1)
13212 (const_int -1)))
13213 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13214 (clobber (match_scratch:SI 4 "=X,X,r"))]
13215 "! TARGET_POWERPC64"
13216 "*
13217 {
13218 if (which_alternative != 0)
13219 return \"#\";
13220 else if (get_attr_length (insn) == 4)
13221 return \"{bdn|bdnz} %l0\";
13222 else
13223 return \"bdz $+8\;b %l0\";
13224 }"
13225 [(set_attr "type" "branch")
13226 (set_attr "length" "*,12,16")])
13227
13228 (define_insn "*ctrsi_internal2"
13229 [(set (pc)
13230 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r")
13231 (const_int 1))
13232 (pc)
13233 (label_ref (match_operand 0 "" ""))))
13234 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
13235 (plus:SI (match_dup 1)
13236 (const_int -1)))
13237 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13238 (clobber (match_scratch:SI 4 "=X,X,r"))]
13239 "! TARGET_POWERPC64"
13240 "*
13241 {
13242 if (which_alternative != 0)
13243 return \"#\";
13244 else if (get_attr_length (insn) == 4)
13245 return \"bdz %l0\";
13246 else
13247 return \"{bdn|bdnz} $+8\;b %l0\";
13248 }"
13249 [(set_attr "type" "branch")
13250 (set_attr "length" "*,12,16")])
13251
13252 (define_insn "*ctrdi_internal1"
13253 [(set (pc)
13254 (if_then_else (ne (match_operand:DI 1 "register_operand" "c,*r,*r,!*f")
13255 (const_int 1))
13256 (label_ref (match_operand 0 "" ""))
13257 (pc)))
13258 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l,!*f")
13259 (plus:DI (match_dup 1)
13260 (const_int -1)))
13261 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13262 (clobber (match_scratch:DI 4 "=X,X,r,r"))]
13263 "TARGET_POWERPC64"
13264 "*
13265 {
13266 if (which_alternative != 0)
13267 return \"#\";
13268 else if (get_attr_length (insn) == 4)
13269 return \"{bdn|bdnz} %l0\";
13270 else
13271 return \"bdz $+8\;b %l0\";
13272 }"
13273 [(set_attr "type" "branch")
13274 (set_attr "length" "*,12,16,24")])
13275
13276 (define_insn "*ctrdi_internal2"
13277 [(set (pc)
13278 (if_then_else (ne (match_operand:DI 1 "register_operand" "c,*r,*r,!*f")
13279 (const_int 1))
13280 (pc)
13281 (label_ref (match_operand 0 "" ""))))
13282 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l,!*f")
13283 (plus:DI (match_dup 1)
13284 (const_int -1)))
13285 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13286 (clobber (match_scratch:DI 4 "=X,X,r,r"))]
13287 "TARGET_POWERPC64"
13288 "*
13289 {
13290 if (which_alternative != 0)
13291 return \"#\";
13292 else if (get_attr_length (insn) == 4)
13293 return \"bdz %l0\";
13294 else
13295 return \"{bdn|bdnz} $+8\;b %l0\";
13296 }"
13297 [(set_attr "type" "branch")
13298 (set_attr "length" "*,12,16,24")])
13299
13300 ;; Similar, but we can use GE since we have a REG_NONNEG.
13301
13302 (define_insn "*ctrsi_internal3"
13303 [(set (pc)
13304 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
13305 (const_int 0))
13306 (label_ref (match_operand 0 "" ""))
13307 (pc)))
13308 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
13309 (plus:SI (match_dup 1)
13310 (const_int -1)))
13311 (clobber (match_scratch:CC 3 "=X,&x,&X"))
13312 (clobber (match_scratch:SI 4 "=X,X,r"))]
13313 "! TARGET_POWERPC64 && find_reg_note (insn, REG_NONNEG, 0)"
13314 "*
13315 {
13316 if (which_alternative != 0)
13317 return \"#\";
13318 else if (get_attr_length (insn) == 4)
13319 return \"{bdn|bdnz} %l0\";
13320 else
13321 return \"bdz $+8\;b %l0\";
13322 }"
13323 [(set_attr "type" "branch")
13324 (set_attr "length" "*,12,16")])
13325
13326 (define_insn "*ctrsi_internal4"
13327 [(set (pc)
13328 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
13329 (const_int 0))
13330 (pc)
13331 (label_ref (match_operand 0 "" ""))))
13332 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
13333 (plus:SI (match_dup 1)
13334 (const_int -1)))
13335 (clobber (match_scratch:CC 3 "=X,&x,&X"))
13336 (clobber (match_scratch:SI 4 "=X,X,r"))]
13337 "! TARGET_POWERPC64 && find_reg_note (insn, REG_NONNEG, 0)"
13338 "*
13339 {
13340 if (which_alternative != 0)
13341 return \"#\";
13342 else if (get_attr_length (insn) == 4)
13343 return \"bdz %l0\";
13344 else
13345 return \"{bdn|bdnz} $+8\;b %l0\";
13346 }"
13347 [(set_attr "type" "branch")
13348 (set_attr "length" "*,12,16")])
13349
13350 (define_insn "*ctrdi_internal3"
13351 [(set (pc)
13352 (if_then_else (ge (match_operand:DI 1 "register_operand" "c,*r,*r,!*f")
13353 (const_int 0))
13354 (label_ref (match_operand 0 "" ""))
13355 (pc)))
13356 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l,!*f")
13357 (plus:DI (match_dup 1)
13358 (const_int -1)))
13359 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13360 (clobber (match_scratch:DI 4 "=X,X,r,r"))]
13361 "TARGET_POWERPC64 && find_reg_note (insn, REG_NONNEG, 0)"
13362 "*
13363 {
13364 if (which_alternative != 0)
13365 return \"#\";
13366 else if (get_attr_length (insn) == 4)
13367 return \"{bdn|bdnz} %l0\";
13368 else
13369 return \"bdz $+8\;b %l0\";
13370 }"
13371 [(set_attr "type" "branch")
13372 (set_attr "length" "*,12,16,24")])
13373
13374 (define_insn "*ctrdi_internal4"
13375 [(set (pc)
13376 (if_then_else (ge (match_operand:DI 1 "register_operand" "c,*r,*r,!*f")
13377 (const_int 0))
13378 (pc)
13379 (label_ref (match_operand 0 "" ""))))
13380 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l,!*f")
13381 (plus:DI (match_dup 1)
13382 (const_int -1)))
13383 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13384 (clobber (match_scratch:DI 4 "=X,X,r,r"))]
13385 "TARGET_POWERPC64 && find_reg_note (insn, REG_NONNEG, 0)"
13386 "*
13387 {
13388 if (which_alternative != 0)
13389 return \"#\";
13390 else if (get_attr_length (insn) == 4)
13391 return \"bdz %l0\";
13392 else
13393 return \"{bdn|bdnz} $+8\;b %l0\";
13394 }"
13395 [(set_attr "type" "branch")
13396 (set_attr "length" "*,12,16,24")])
13397
13398 ;; Similar but use EQ
13399
13400 (define_insn "*ctrsi_internal5"
13401 [(set (pc)
13402 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r")
13403 (const_int 1))
13404 (label_ref (match_operand 0 "" ""))
13405 (pc)))
13406 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
13407 (plus:SI (match_dup 1)
13408 (const_int -1)))
13409 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13410 (clobber (match_scratch:SI 4 "=X,X,r"))]
13411 "! TARGET_POWERPC64"
13412 "*
13413 {
13414 if (which_alternative != 0)
13415 return \"#\";
13416 else if (get_attr_length (insn) == 4)
13417 return \"bdz %l0\";
13418 else
13419 return \"{bdn|bdnz} $+8\;b %l0\";
13420 }"
13421 [(set_attr "type" "branch")
13422 (set_attr "length" "*,12,16")])
13423
13424 (define_insn "*ctrsi_internal6"
13425 [(set (pc)
13426 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r")
13427 (const_int 1))
13428 (pc)
13429 (label_ref (match_operand 0 "" ""))))
13430 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
13431 (plus:SI (match_dup 1)
13432 (const_int -1)))
13433 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13434 (clobber (match_scratch:SI 4 "=X,X,r"))]
13435 "! TARGET_POWERPC64"
13436 "*
13437 {
13438 if (which_alternative != 0)
13439 return \"#\";
13440 else if (get_attr_length (insn) == 4)
13441 return \"{bdn|bdnz} %l0\";
13442 else
13443 return \"bdz $+8\;b %l0\";
13444 }"
13445 [(set_attr "type" "branch")
13446 (set_attr "length" "*,12,16")])
13447
13448 (define_insn "*ctrdi_internal5"
13449 [(set (pc)
13450 (if_then_else (eq (match_operand:DI 1 "register_operand" "c,*r,*r,!*f")
13451 (const_int 1))
13452 (label_ref (match_operand 0 "" ""))
13453 (pc)))
13454 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l,!*f")
13455 (plus:DI (match_dup 1)
13456 (const_int -1)))
13457 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13458 (clobber (match_scratch:DI 4 "=X,X,r,r"))]
13459 "TARGET_POWERPC64"
13460 "*
13461 {
13462 if (which_alternative != 0)
13463 return \"#\";
13464 else if (get_attr_length (insn) == 4)
13465 return \"bdz %l0\";
13466 else
13467 return \"{bdn|bdnz} $+8\;b %l0\";
13468 }"
13469 [(set_attr "type" "branch")
13470 (set_attr "length" "*,12,16,24")])
13471
13472 (define_insn "*ctrdi_internal6"
13473 [(set (pc)
13474 (if_then_else (eq (match_operand:DI 1 "register_operand" "c,*r,*r,!*f")
13475 (const_int 1))
13476 (pc)
13477 (label_ref (match_operand 0 "" ""))))
13478 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l,!*f")
13479 (plus:DI (match_dup 1)
13480 (const_int -1)))
13481 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13482 (clobber (match_scratch:DI 4 "=X,X,r,r"))]
13483 "TARGET_POWERPC64"
13484 "*
13485 {
13486 if (which_alternative != 0)
13487 return \"#\";
13488 else if (get_attr_length (insn) == 4)
13489 return \"{bdn|bdnz} %l0\";
13490 else
13491 return \"bdz $+8\;b %l0\";
13492 }"
13493 [(set_attr "type" "branch")
13494 (set_attr "length" "*,12,16,24")])
13495
13496 ;; Now the splitters if we could not allocate the CTR register
13497
13498 (define_split
13499 [(set (pc)
13500 (if_then_else (match_operator 2 "comparison_operator"
13501 [(match_operand:SI 1 "gpc_reg_operand" "")
13502 (const_int 1)])
13503 (match_operand 5 "" "")
13504 (match_operand 6 "" "")))
13505 (set (match_operand:SI 0 "gpc_reg_operand" "")
13506 (plus:SI (match_dup 1)
13507 (const_int -1)))
13508 (clobber (match_scratch:CC 3 ""))
13509 (clobber (match_scratch:SI 4 ""))]
13510 "! TARGET_POWERPC64 && reload_completed"
13511 [(parallel [(set (match_dup 3)
13512 (compare:CC (plus:SI (match_dup 1)
13513 (const_int -1))
13514 (const_int 0)))
13515 (set (match_dup 0)
13516 (plus:SI (match_dup 1)
13517 (const_int -1)))])
13518 (set (pc) (if_then_else (match_dup 7)
13519 (match_dup 5)
13520 (match_dup 6)))]
13521 "
13522 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
13523 const0_rtx); }")
13524
13525 (define_split
13526 [(set (pc)
13527 (if_then_else (match_operator 2 "comparison_operator"
13528 [(match_operand:SI 1 "gpc_reg_operand" "")
13529 (const_int 1)])
13530 (match_operand 5 "" "")
13531 (match_operand 6 "" "")))
13532 (set (match_operand:SI 0 "nonimmediate_operand" "")
13533 (plus:SI (match_dup 1) (const_int -1)))
13534 (clobber (match_scratch:CC 3 ""))
13535 (clobber (match_scratch:SI 4 ""))]
13536 "! TARGET_POWERPC64 && reload_completed
13537 && ! gpc_reg_operand (operands[0], SImode)"
13538 [(parallel [(set (match_dup 3)
13539 (compare:CC (plus:SI (match_dup 1)
13540 (const_int -1))
13541 (const_int 0)))
13542 (set (match_dup 4)
13543 (plus:SI (match_dup 1)
13544 (const_int -1)))])
13545 (set (match_dup 0)
13546 (match_dup 4))
13547 (set (pc) (if_then_else (match_dup 7)
13548 (match_dup 5)
13549 (match_dup 6)))]
13550 "
13551 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
13552 const0_rtx); }")
13553 (define_split
13554 [(set (pc)
13555 (if_then_else (match_operator 2 "comparison_operator"
13556 [(match_operand:DI 1 "gpc_reg_operand" "")
13557 (const_int 1)])
13558 (match_operand 5 "" "")
13559 (match_operand 6 "" "")))
13560 (set (match_operand:DI 0 "gpc_reg_operand" "")
13561 (plus:DI (match_dup 1)
13562 (const_int -1)))
13563 (clobber (match_scratch:CC 3 ""))
13564 (clobber (match_scratch:DI 4 ""))]
13565 "TARGET_POWERPC64 && reload_completed && INT_REGNO_P (REGNO (operands[0]))"
13566 [(parallel [(set (match_dup 3)
13567 (compare:CC (plus:DI (match_dup 1)
13568 (const_int -1))
13569 (const_int 0)))
13570 (set (match_dup 0)
13571 (plus:DI (match_dup 1)
13572 (const_int -1)))])
13573 (set (pc) (if_then_else (match_dup 7)
13574 (match_dup 5)
13575 (match_dup 6)))]
13576 "
13577 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
13578 const0_rtx); }")
13579
13580 (define_split
13581 [(set (pc)
13582 (if_then_else (match_operator 2 "comparison_operator"
13583 [(match_operand:DI 1 "gpc_reg_operand" "")
13584 (const_int 1)])
13585 (match_operand 5 "" "")
13586 (match_operand 6 "" "")))
13587 (set (match_operand:DI 0 "nonimmediate_operand" "")
13588 (plus:DI (match_dup 1) (const_int -1)))
13589 (clobber (match_scratch:CC 3 ""))
13590 (clobber (match_scratch:DI 4 ""))]
13591 "TARGET_POWERPC64 && reload_completed
13592 && ! gpc_reg_operand (operands[0], DImode)"
13593 [(parallel [(set (match_dup 3)
13594 (compare:CC (plus:DI (match_dup 1)
13595 (const_int -1))
13596 (const_int 0)))
13597 (set (match_dup 4)
13598 (plus:DI (match_dup 1)
13599 (const_int -1)))])
13600 (set (match_dup 0)
13601 (match_dup 4))
13602 (set (pc) (if_then_else (match_dup 7)
13603 (match_dup 5)
13604 (match_dup 6)))]
13605 "
13606 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
13607 const0_rtx); }")
13608
13609 (define_split
13610 [(set (pc)
13611 (if_then_else (match_operator 2 "comparison_operator"
13612 [(match_operand:DI 1 "gpc_reg_operand" "")
13613 (const_int 1)])
13614 (match_operand 5 "" "")
13615 (match_operand 6 "" "")))
13616 (set (match_operand:DI 0 "gpc_reg_operand" "")
13617 (plus:DI (match_dup 1)
13618 (const_int -1)))
13619 (clobber (match_scratch:CC 3 ""))
13620 (clobber (match_scratch:DI 4 ""))]
13621 "TARGET_POWERPC64 && reload_completed && FP_REGNO_P (REGNO (operands[0]))"
13622 [(set (match_dup 8)
13623 (match_dup 1))
13624 (set (match_dup 4)
13625 (match_dup 8))
13626 (parallel [(set (match_dup 3)
13627 (compare:CC (plus:DI (match_dup 4)
13628 (const_int -1))
13629 (const_int 0)))
13630 (set (match_dup 4)
13631 (plus:DI (match_dup 4)
13632 (const_int -1)))])
13633 (set (match_dup 8)
13634 (match_dup 4))
13635 (set (match_dup 0)
13636 (match_dup 8))
13637 (set (pc) (if_then_else (match_dup 7)
13638 (match_dup 5)
13639 (match_dup 6)))]
13640 "
13641 {
13642 operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
13643 const0_rtx);
13644 operands[8] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
13645 }")
13646
13647 \f
13648 (define_insn "trap"
13649 [(trap_if (const_int 1) (const_int 0))]
13650 ""
13651 "{t 31,0,0|trap}")
13652
13653 (define_expand "conditional_trap"
13654 [(trap_if (match_operator 0 "trap_comparison_operator"
13655 [(match_dup 2) (match_dup 3)])
13656 (match_operand 1 "const_int_operand" ""))]
13657 ""
13658 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
13659 operands[2] = rs6000_compare_op0;
13660 operands[3] = rs6000_compare_op1;")
13661
13662 (define_insn ""
13663 [(trap_if (match_operator 0 "trap_comparison_operator"
13664 [(match_operand:SI 1 "register_operand" "r")
13665 (match_operand:SI 2 "reg_or_short_operand" "rI")])
13666 (const_int 0))]
13667 ""
13668 "{t|tw}%V0%I2 %1,%2")
13669
13670 (define_insn ""
13671 [(trap_if (match_operator 0 "trap_comparison_operator"
13672 [(match_operand:DI 1 "register_operand" "r")
13673 (match_operand:DI 2 "reg_or_short_operand" "rI")])
13674 (const_int 0))]
13675 "TARGET_POWERPC64"
13676 "td%V0%I2 %1,%2")
13677 \f
13678 ;; Insns related to generating the function prologue and epilogue.
13679
13680 (define_expand "prologue"
13681 [(use (const_int 0))]
13682 "TARGET_SCHED_PROLOG"
13683 "
13684 {
13685 rs6000_emit_prologue ();
13686 DONE;
13687 }")
13688
13689 (define_insn "movesi_from_cr"
13690 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13691 (unspec:SI [(reg:CC 68) (reg:CC 69) (reg:CC 70) (reg:CC 71)
13692 (reg:CC 72) (reg:CC 73) (reg:CC 74) (reg:CC 75)] 19))]
13693 ""
13694 "mfcr %0")
13695
13696 (define_insn "*stmw"
13697 [(match_parallel 0 "stmw_operation"
13698 [(set (match_operand:SI 1 "memory_operand" "=m")
13699 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
13700 "TARGET_MULTIPLE"
13701 "{stm|stmw} %2,%1")
13702
13703 (define_insn "*save_fpregs_si"
13704 [(match_parallel 0 "any_operand"
13705 [(clobber (match_operand:SI 1 "register_operand" "=l"))
13706 (use (match_operand:SI 2 "call_operand" "s"))
13707 (set (match_operand:DF 3 "memory_operand" "=m")
13708 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
13709 "TARGET_32BIT"
13710 "bl %z2")
13711
13712 (define_insn "*save_fpregs_di"
13713 [(match_parallel 0 "any_operand"
13714 [(clobber (match_operand:DI 1 "register_operand" "=l"))
13715 (use (match_operand:DI 2 "call_operand" "s"))
13716 (set (match_operand:DF 3 "memory_operand" "=m")
13717 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
13718 "TARGET_64BIT"
13719 "bl %z2")
13720
13721 ; These are to explain that changes to the stack pointer should
13722 ; not be moved over stores to stack memory.
13723 (define_insn "stack_tie"
13724 [(set (match_operand:BLK 0 "memory_operand" "+m")
13725 (unspec:BLK [(match_dup 0)] 5))]
13726 ""
13727 ""
13728 [(set_attr "length" "0")])
13729
13730
13731 (define_expand "epilogue"
13732 [(use (const_int 0))]
13733 "TARGET_SCHED_PROLOG"
13734 "
13735 {
13736 rs6000_emit_epilogue (FALSE);
13737 DONE;
13738 }")
13739
13740 ; On some processors, doing the mtcrf one CC register at a time is
13741 ; faster (like on the 604e). On others, doing them all at once is
13742 ; faster; for instance, on the 601 and 750.
13743
13744 (define_expand "movsi_to_cr_one"
13745 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
13746 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
13747 (match_dup 2)] 20))]
13748 ""
13749 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
13750
13751 (define_insn "*movsi_to_cr"
13752 [(match_parallel 0 "mtcrf_operation"
13753 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
13754 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
13755 (match_operand 3 "immediate_operand" "n")]
13756 20))])]
13757 ""
13758 "*
13759 {
13760 int mask = 0;
13761 int i;
13762 for (i = 0; i < XVECLEN (operands[0], 0); i++)
13763 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
13764 operands[4] = GEN_INT (mask);
13765 return \"mtcrf %4,%2\";
13766 }")
13767
13768 (define_insn ""
13769 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
13770 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
13771 (match_operand 2 "immediate_operand" "n")] 20))]
13772 "GET_CODE (operands[0]) == REG
13773 && CR_REGNO_P (REGNO (operands[0]))
13774 && GET_CODE (operands[2]) == CONST_INT
13775 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
13776 "mtcrf %R0,%1")
13777
13778 ; The load-multiple instructions have similar properties.
13779 ; Note that "load_multiple" is a name known to the machine-independent
13780 ; code that actually corresponds to the powerpc load-string.
13781
13782 (define_insn "*lmw"
13783 [(match_parallel 0 "lmw_operation"
13784 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
13785 (match_operand:SI 2 "memory_operand" "m"))])]
13786 "TARGET_MULTIPLE"
13787 "{lm|lmw} %1,%2")
13788
13789 (define_insn "*return_internal_si"
13790 [(return)
13791 (use (match_operand:SI 0 "register_operand" "lc"))]
13792 "TARGET_32BIT"
13793 "b%T0"
13794 [(set_attr "type" "jmpreg")])
13795
13796 (define_insn "*return_internal_di"
13797 [(return)
13798 (use (match_operand:DI 0 "register_operand" "lc"))]
13799 "TARGET_64BIT"
13800 "b%T0"
13801 [(set_attr "type" "jmpreg")])
13802
13803 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
13804 ; stuff was in GCC. Oh, and "any_operand" is a bit flexible...
13805
13806 (define_insn "*return_and_restore_fpregs_si"
13807 [(match_parallel 0 "any_operand"
13808 [(return)
13809 (use (match_operand:SI 1 "register_operand" "l"))
13810 (use (match_operand:SI 2 "call_operand" "s"))
13811 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
13812 (match_operand:DF 4 "memory_operand" "m"))])]
13813 "TARGET_32BIT"
13814 "b %z2")
13815
13816 (define_insn "*return_and_restore_fpregs_di"
13817 [(match_parallel 0 "any_operand"
13818 [(return)
13819 (use (match_operand:DI 1 "register_operand" "l"))
13820 (use (match_operand:DI 2 "call_operand" "s"))
13821 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
13822 (match_operand:DF 4 "memory_operand" "m"))])]
13823 "TARGET_64BIT"
13824 "b %z2")
13825
13826 ; This is used in compiling the unwind routines.
13827 (define_expand "eh_return"
13828 [(use (match_operand 0 "general_operand" ""))
13829 (use (match_operand 1 "general_operand" ""))]
13830 ""
13831 "
13832 {
13833 #if TARGET_AIX
13834 rs6000_emit_eh_toc_restore (operands[0]);
13835 #endif
13836 if (TARGET_32BIT)
13837 emit_insn (gen_eh_set_lr_si (operands[1]));
13838 else
13839 emit_insn (gen_eh_set_lr_di (operands[1]));
13840 emit_move_insn (EH_RETURN_STACKADJ_RTX, operands[0]);
13841 DONE;
13842 }")
13843
13844 ; We can't expand this before we know where the link register is stored.
13845 (define_insn "eh_set_lr_si"
13846 [(unspec_volatile [(match_operand:SI 0 "register_operand" "r")] 9)
13847 (clobber (match_scratch:SI 1 "=&b"))]
13848 "TARGET_32BIT"
13849 "#")
13850
13851 (define_insn "eh_set_lr_di"
13852 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")] 9)
13853 (clobber (match_scratch:DI 1 "=&b"))]
13854 "TARGET_64BIT"
13855 "#")
13856
13857 (define_split
13858 [(unspec_volatile [(match_operand 0 "register_operand" "")] 9)
13859 (clobber (match_scratch 1 ""))]
13860 "reload_completed"
13861 [(const_int 0)]
13862 "
13863 {
13864 rs6000_stack_t *info = rs6000_stack_info ();
13865
13866 if (info->lr_save_p)
13867 {
13868 rtx frame_rtx = stack_pointer_rtx;
13869 int sp_offset = 0;
13870 rtx tmp;
13871
13872 if (frame_pointer_needed
13873 || current_function_calls_alloca
13874 || info->total_size > 32767)
13875 {
13876 emit_move_insn (operands[1], gen_rtx_MEM (Pmode, frame_rtx));
13877 frame_rtx = operands[1];
13878 }
13879 else if (info->push_p)
13880 sp_offset = info->total_size;
13881
13882 tmp = plus_constant (frame_rtx, info->lr_save_offset + sp_offset);
13883 tmp = gen_rtx_MEM (Pmode, tmp);
13884 emit_move_insn (tmp, operands[0]);
13885 }
13886 else
13887 emit_move_insn (gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM), operands[0]);
13888 DONE;
13889 }")
13890
13891 (define_insn "prefetch"
13892 [(prefetch (match_operand:V4SI 0 "address_operand" "p")
13893 (match_operand:SI 1 "const_int_operand" "n")
13894 (match_operand:SI 2 "const_int_operand" "n"))]
13895 "TARGET_POWERPC"
13896 "*
13897 {
13898 if (GET_CODE (operands[0]) == REG)
13899 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
13900 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
13901 }"
13902 [(set_attr "type" "load")])
13903 \f
13904 ;; AltiVec patterns
13905
13906 ;; Generic LVX load instruction.
13907 (define_insn "altivec_lvx_4si"
13908 [(set (match_operand:V4SI 0 "altivec_register_operand" "=v")
13909 (match_operand:V4SI 1 "memory_operand" "m"))]
13910 "TARGET_ALTIVEC"
13911 "lvx %0,%y1"
13912 [(set_attr "type" "vecload")])
13913
13914 (define_insn "altivec_lvx_8hi"
13915 [(set (match_operand:V8HI 0 "altivec_register_operand" "=v")
13916 (match_operand:V8HI 1 "memory_operand" "m"))]
13917 "TARGET_ALTIVEC"
13918 "lvx %0,%y1"
13919 [(set_attr "type" "vecload")])
13920
13921 (define_insn "altivec_lvx_16qi"
13922 [(set (match_operand:V16QI 0 "altivec_register_operand" "=v")
13923 (match_operand:V16QI 1 "memory_operand" "m"))]
13924 "TARGET_ALTIVEC"
13925 "lvx %0,%y1"
13926 [(set_attr "type" "vecload")])
13927
13928 (define_insn "altivec_lvx_4sf"
13929 [(set (match_operand:V4SF 0 "altivec_register_operand" "=v")
13930 (match_operand:V4SF 1 "memory_operand" "m"))]
13931 "TARGET_ALTIVEC"
13932 "lvx %0,%y1"
13933 [(set_attr "type" "vecload")])
13934
13935 ;; Generic STVX store instruction.
13936 (define_insn "altivec_stvx_4si"
13937 [(set (match_operand:V4SI 0 "memory_operand" "=m")
13938 (match_operand:V4SI 1 "altivec_register_operand" "v"))]
13939 "TARGET_ALTIVEC"
13940 "stvx %1,%y0"
13941 [(set_attr "type" "vecstore")])
13942
13943 (define_insn "altivec_stvx_8hi"
13944 [(set (match_operand:V8HI 0 "memory_operand" "=m")
13945 (match_operand:V8HI 1 "altivec_register_operand" "v"))]
13946 "TARGET_ALTIVEC"
13947 "stvx %1,%y0"
13948 [(set_attr "type" "vecstore")])
13949
13950 (define_insn "altivec_stvx_16qi"
13951 [(set (match_operand:V16QI 0 "memory_operand" "=m")
13952 (match_operand:V16QI 1 "altivec_register_operand" "v"))]
13953 "TARGET_ALTIVEC"
13954 "stvx %1,%y0"
13955 [(set_attr "type" "vecstore")])
13956
13957 (define_insn "altivec_stvx_4sf"
13958 [(set (match_operand:V4SF 0 "memory_operand" "=m")
13959 (match_operand:V4SF 1 "altivec_register_operand" "v"))]
13960 "TARGET_ALTIVEC"
13961 "stvx %1,%y0"
13962 [(set_attr "type" "vecstore")])
13963
13964 ;; Vector move instructions.
13965 (define_expand "movv4si"
13966 [(set (match_operand:V4SI 0 "nonimmediate_operand" "")
13967 (match_operand:V4SI 1 "any_operand" ""))]
13968 "TARGET_ALTIVEC"
13969 "{ rs6000_emit_move (operands[0], operands[1], V4SImode); DONE; }")
13970
13971 (define_insn "*movv4si_internal"
13972 [(set (match_operand:V4SI 0 "nonimmediate_operand" "=m,v,v,o,r,r")
13973 (match_operand:V4SI 1 "input_operand" "v,m,v,r,o,r"))]
13974 "TARGET_ALTIVEC"
13975 "@
13976 stvx %1,%y0
13977 lvx %0,%y1
13978 vor %0,%1,%1
13979 stw%U0 %1,%0\;stw %L1,%L0\;stw %Y1,%Y0\;stw %Z1,%Z0
13980 lwz%U1 %0,%1\;lwz %L0,%L1\;lwz %Y0,%Y1\;lwz %Z0,%Z1
13981 mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1"
13982 [(set_attr "type" "altivec")
13983 (set_attr "length" "*,*,*,16,16,16")])
13984
13985 (define_expand "movv8hi"
13986 [(set (match_operand:V8HI 0 "nonimmediate_operand" "")
13987 (match_operand:V8HI 1 "any_operand" ""))]
13988 "TARGET_ALTIVEC"
13989 "{ rs6000_emit_move (operands[0], operands[1], V8HImode); DONE; }")
13990
13991 (define_insn "*movv8hi_internal1"
13992 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=m,v,v,o,r,r")
13993 (match_operand:V8HI 1 "input_operand" "v,m,v,r,o,r"))]
13994 "TARGET_ALTIVEC"
13995 "@
13996 stvx %1,%y0
13997 lvx %0,%y1
13998 vor %0,%1,%1
13999 stw%U0 %1,%0\;stw %L1,%L0\;stw %Y1,%Y0\;stw %Z1,%Z0
14000 lwz%U1 %0,%1\;lwz %L0,%L1\;lwz %Y0,%Y1\;lwz %Z0,%Z1
14001 mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1"
14002 [(set_attr "type" "altivec")
14003 (set_attr "length" "*,*,*,16,16,16")])
14004
14005 (define_expand "movv16qi"
14006 [(set (match_operand:V16QI 0 "nonimmediate_operand" "")
14007 (match_operand:V16QI 1 "any_operand" ""))]
14008 "TARGET_ALTIVEC"
14009 "{ rs6000_emit_move (operands[0], operands[1], V16QImode); DONE; }")
14010
14011 (define_insn "*movv16qi_internal1"
14012 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=m,v,v,o,r,r")
14013 (match_operand:V16QI 1 "input_operand" "v,m,v,r,o,r"))]
14014 "TARGET_ALTIVEC"
14015 "@
14016 stvx %1,%y0
14017 lvx %0,%y1
14018 vor %0,%1,%1
14019 stw%U0 %1,%0\;stw %L1,%L0\;stw %Y1,%Y0\;stw %Z1,%Z0
14020 lwz%U1 %0,%1\;lwz %L0,%L1\;lwz %Y0,%Y1\;lwz %Z0,%Z1
14021 mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1"
14022 [(set_attr "type" "altivec")
14023 (set_attr "length" "*,*,*,16,16,16")])
14024
14025 (define_expand "movv4sf"
14026 [(set (match_operand:V4SF 0 "nonimmediate_operand" "")
14027 (match_operand:V4SF 1 "any_operand" ""))]
14028 "TARGET_ALTIVEC"
14029 "{ rs6000_emit_move (operands[0], operands[1], V4SFmode); DONE; }")
14030
14031 (define_insn "*movv4sf_internal1"
14032 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=m,v,v,o,r,r")
14033 (match_operand:V4SF 1 "input_operand" "v,m,v,r,o,r"))]
14034 "TARGET_ALTIVEC"
14035 "@
14036 stvx %1,%y0
14037 lvx %0,%y1
14038 vor %0,%1,%1
14039 stw%U0 %1,%0\;stw %L1,%L0\;stw %Y1,%Y0\;stw %Z1,%Z0
14040 lwz%U1 %0,%1\;lwz %L0,%L1\;lwz %Y0,%Y1\;lwz %Z0,%Z1
14041 mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1"
14042 [(set_attr "type" "altivec")
14043 (set_attr "length" "*,*,*,16,16,16")])
14044
14045 (define_insn "get_vrsave_internal"
14046 [(set (match_operand:SI 0 "register_operand" "=r")
14047 (unspec:SI [(reg:SI 109)] 214))]
14048 "TARGET_ALTIVEC"
14049 "*
14050 {
14051 if (TARGET_MACHO)
14052 return \"mfspr %0,256\";
14053 else
14054 return \"mfvrsave %0\";
14055 }"
14056 [(set_attr "type" "altivec")])
14057
14058 (define_insn "*set_vrsave_internal"
14059 [(match_parallel 0 "vrsave_operation"
14060 [(set (reg:SI 109)
14061 (unspec_volatile:SI [(match_operand:SI 1 "register_operand" "r")
14062 (reg:SI 109)] 30))])]
14063 "TARGET_ALTIVEC"
14064 "*
14065 {
14066 if (TARGET_MACHO)
14067 return \"mtspr 256,%1\";
14068 else
14069 return \"mtvrsave %1\";
14070 }"
14071 [(set_attr "type" "altivec")])
14072
14073 ;; Vector clears
14074 (define_insn "*movv4si_const0"
14075 [(set (match_operand:V4SI 0 "altivec_register_operand" "=v")
14076 (match_operand:V4SI 1 "zero_constant" ""))]
14077 "TARGET_ALTIVEC"
14078 "vxor %0,%0,%0"
14079 [(set_attr "type" "vecsimple")])
14080
14081 (define_insn "*movv4sf_const0"
14082 [(set (match_operand:V4SF 0 "altivec_register_operand" "=v")
14083 (match_operand:V4SF 1 "zero_constant" ""))]
14084
14085 "TARGET_ALTIVEC"
14086 "vxor %0,%0,%0"
14087 [(set_attr "type" "vecsimple")])
14088
14089 (define_insn "*movv8hi_const0"
14090 [(set (match_operand:V8HI 0 "altivec_register_operand" "=v")
14091 (match_operand:V8HI 1 "zero_constant" ""))]
14092 "TARGET_ALTIVEC"
14093 "vxor %0,%0,%0"
14094 [(set_attr "type" "vecsimple")])
14095
14096 (define_insn "*movv16qi_const0"
14097 [(set (match_operand:V16QI 0 "altivec_register_operand" "=v")
14098 (match_operand:V16QI 1 "zero_constant" ""))]
14099 "TARGET_ALTIVEC"
14100 "vxor %0,%0,%0"
14101 [(set_attr "type" "vecsimple")])
14102
14103 ;; Simple binary operations.
14104
14105 (define_insn "addv16qi3"
14106 [(set (match_operand:V16QI 0 "register_operand" "=v")
14107 (plus:V16QI (match_operand:V16QI 1 "register_operand" "v")
14108 (match_operand:V16QI 2 "register_operand" "v")))]
14109 "TARGET_ALTIVEC"
14110 "vaddubm %0,%1,%2"
14111 [(set_attr "type" "vecsimple")])
14112
14113 (define_insn "addv8hi3"
14114 [(set (match_operand:V8HI 0 "register_operand" "=v")
14115 (plus:V8HI (match_operand:V8HI 1 "register_operand" "v")
14116 (match_operand:V8HI 2 "register_operand" "v")))]
14117 "TARGET_ALTIVEC"
14118 "vadduhm %0,%1,%2"
14119 [(set_attr "type" "vecsimple")])
14120
14121 (define_insn "addv4si3"
14122 [(set (match_operand:V4SI 0 "register_operand" "=v")
14123 (plus:V4SI (match_operand:V4SI 1 "register_operand" "v")
14124 (match_operand:V4SI 2 "register_operand" "v")))]
14125 "TARGET_ALTIVEC"
14126 "vadduwm %0,%1,%2"
14127 [(set_attr "type" "vecsimple")])
14128
14129 (define_insn "addv4sf3"
14130 [(set (match_operand:V4SF 0 "register_operand" "=v")
14131 (plus:V4SF (match_operand:V4SF 1 "register_operand" "v")
14132 (match_operand:V4SF 2 "register_operand" "v")))]
14133 "TARGET_ALTIVEC"
14134 "vaddfp %0,%1,%2"
14135 [(set_attr "type" "vecfloat")])
14136
14137 (define_insn "altivec_vaddcuw"
14138 [(set (match_operand:V4SI 0 "register_operand" "=v")
14139 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
14140 (match_operand:V4SI 2 "register_operand" "v")] 35))]
14141 "TARGET_ALTIVEC"
14142 "vaddcuw %0,%1,%2"
14143 [(set_attr "type" "vecsimple")])
14144
14145 (define_insn "altivec_vaddubs"
14146 [(set (match_operand:V16QI 0 "register_operand" "=v")
14147 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
14148 (match_operand:V16QI 2 "register_operand" "v")] 36))]
14149 "TARGET_ALTIVEC"
14150 "vaddubs %0,%1,%2"
14151 [(set_attr "type" "vecsimple")])
14152
14153 (define_insn "altivec_vaddsbs"
14154 [(set (match_operand:V16QI 0 "register_operand" "=v")
14155 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
14156 (match_operand:V16QI 2 "register_operand" "v")] 37))]
14157 "TARGET_ALTIVEC"
14158 "vaddsbs %0,%1,%2"
14159 [(set_attr "type" "vecsimple")])
14160
14161 (define_insn "altivec_vadduhs"
14162 [(set (match_operand:V8HI 0 "register_operand" "=v")
14163 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
14164 (match_operand:V8HI 2 "register_operand" "v")] 38))]
14165 "TARGET_ALTIVEC"
14166 "vadduhs %0,%1,%2"
14167 [(set_attr "type" "vecsimple")])
14168
14169 (define_insn "altivec_vaddshs"
14170 [(set (match_operand:V8HI 0 "register_operand" "=v")
14171 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
14172 (match_operand:V8HI 2 "register_operand" "v")] 39))]
14173 "TARGET_ALTIVEC"
14174 "vaddshs %0,%1,%2"
14175 [(set_attr "type" "vecsimple")])
14176
14177 (define_insn "altivec_vadduws"
14178 [(set (match_operand:V4SI 0 "register_operand" "=v")
14179 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
14180 (match_operand:V4SI 2 "register_operand" "v")] 40))]
14181 "TARGET_ALTIVEC"
14182 "vadduws %0,%1,%2"
14183 [(set_attr "type" "vecsimple")])
14184
14185 (define_insn "altivec_vaddsws"
14186 [(set (match_operand:V4SI 0 "register_operand" "=v")
14187 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
14188 (match_operand:V4SI 2 "register_operand" "v")] 41))]
14189 "TARGET_ALTIVEC"
14190 "vaddsws %0,%1,%2"
14191 [(set_attr "type" "vecsimple")])
14192
14193 (define_insn "andv4si3"
14194 [(set (match_operand:V4SI 0 "register_operand" "=v")
14195 (and:V4SI (match_operand:V4SI 1 "register_operand" "v")
14196 (match_operand:V4SI 2 "register_operand" "v")))]
14197 "TARGET_ALTIVEC"
14198 "vand %0,%1,%2"
14199 [(set_attr "type" "vecsimple")])
14200
14201 (define_insn "altivec_vandc"
14202 [(set (match_operand:V4SI 0 "register_operand" "=v")
14203 (and:V4SI (match_operand:V4SI 1 "register_operand" "v")
14204 (not:V4SI (match_operand:V4SI 2 "register_operand" "v"))))]
14205 "TARGET_ALTIVEC"
14206 "vandc %0,%1,%2"
14207 [(set_attr "type" "vecsimple")])
14208
14209 (define_insn "altivec_vavgub"
14210 [(set (match_operand:V16QI 0 "register_operand" "=v")
14211 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
14212 (match_operand:V16QI 2 "register_operand" "v")] 44))]
14213 "TARGET_ALTIVEC"
14214 "vavgub %0,%1,%2"
14215 [(set_attr "type" "vecsimple")])
14216
14217 (define_insn "altivec_vavgsb"
14218 [(set (match_operand:V16QI 0 "register_operand" "=v")
14219 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
14220 (match_operand:V16QI 2 "register_operand" "v")] 45))]
14221 "TARGET_ALTIVEC"
14222 "vavgsb %0,%1,%2"
14223 [(set_attr "type" "vecsimple")])
14224
14225 (define_insn "altivec_vavguh"
14226 [(set (match_operand:V8HI 0 "register_operand" "=v")
14227 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
14228 (match_operand:V8HI 2 "register_operand" "v")] 46))]
14229 "TARGET_ALTIVEC"
14230 "vavguh %0,%1,%2"
14231 [(set_attr "type" "vecsimple")])
14232
14233 (define_insn "altivec_vavgsh"
14234 [(set (match_operand:V8HI 0 "register_operand" "=v")
14235 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
14236 (match_operand:V8HI 2 "register_operand" "v")] 47))]
14237 "TARGET_ALTIVEC"
14238 "vavgsh %0,%1,%2"
14239 [(set_attr "type" "vecsimple")])
14240
14241 (define_insn "altivec_vavguw"
14242 [(set (match_operand:V4SI 0 "register_operand" "=v")
14243 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
14244 (match_operand:V4SI 2 "register_operand" "v")] 48))]
14245 "TARGET_ALTIVEC"
14246 "vavguw %0,%1,%2"
14247 [(set_attr "type" "vecsimple")])
14248
14249 (define_insn "altivec_vavgsw"
14250 [(set (match_operand:V4SI 0 "register_operand" "=v")
14251 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
14252 (match_operand:V4SI 2 "register_operand" "v")] 49))]
14253 "TARGET_ALTIVEC"
14254 "vavgsw %0,%1,%2"
14255 [(set_attr "type" "vecsimple")])
14256
14257 (define_insn "altivec_vcmpbfp"
14258 [(set (match_operand:V4SI 0 "register_operand" "=v")
14259 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
14260 (match_operand:V4SF 2 "register_operand" "v")] 50))]
14261 "TARGET_ALTIVEC"
14262 "vcmpbfp %0,%1,%2"
14263 [(set_attr "type" "veccmp")])
14264
14265 (define_insn "altivec_vcmpequb"
14266 [(set (match_operand:V16QI 0 "register_operand" "=v")
14267 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
14268 (match_operand:V16QI 2 "register_operand" "v")] 51))]
14269 "TARGET_ALTIVEC"
14270 "vcmpequb %0,%1,%2"
14271 [(set_attr "type" "vecsimple")])
14272
14273 (define_insn "altivec_vcmpequh"
14274 [(set (match_operand:V8HI 0 "register_operand" "=v")
14275 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
14276 (match_operand:V8HI 2 "register_operand" "v")] 52))]
14277 "TARGET_ALTIVEC"
14278 "vcmpequh %0,%1,%2"
14279 [(set_attr "type" "vecsimple")])
14280
14281 (define_insn "altivec_vcmpequw"
14282 [(set (match_operand:V4SI 0 "register_operand" "=v")
14283 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
14284 (match_operand:V4SI 2 "register_operand" "v")] 53))]
14285 "TARGET_ALTIVEC"
14286 "vcmpequw %0,%1,%2"
14287 [(set_attr "type" "vecsimple")])
14288
14289 (define_insn "altivec_vcmpeqfp"
14290 [(set (match_operand:V4SI 0 "register_operand" "=v")
14291 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
14292 (match_operand:V4SF 2 "register_operand" "v")] 54))]
14293 "TARGET_ALTIVEC"
14294 "vcmpeqfp %0,%1,%2"
14295 [(set_attr "type" "veccmp")])
14296
14297 (define_insn "altivec_vcmpgefp"
14298 [(set (match_operand:V4SI 0 "register_operand" "=v")
14299 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
14300 (match_operand:V4SF 2 "register_operand" "v")] 55))]
14301 "TARGET_ALTIVEC"
14302 "vcmpgefp %0,%1,%2"
14303 [(set_attr "type" "veccmp")])
14304
14305 (define_insn "altivec_vcmpgtub"
14306 [(set (match_operand:V16QI 0 "register_operand" "=v")
14307 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
14308 (match_operand:V16QI 2 "register_operand" "v")] 56))]
14309 "TARGET_ALTIVEC"
14310 "vcmpgtub %0,%1,%2"
14311 [(set_attr "type" "vecsimple")])
14312
14313 (define_insn "altivec_vcmpgtsb"
14314 [(set (match_operand:V16QI 0 "register_operand" "=v")
14315 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
14316 (match_operand:V16QI 2 "register_operand" "v")] 57))]
14317 "TARGET_ALTIVEC"
14318 "vcmpgtsb %0,%1,%2"
14319 [(set_attr "type" "vecsimple")])
14320
14321 (define_insn "altivec_vcmpgtuh"
14322 [(set (match_operand:V8HI 0 "register_operand" "=v")
14323 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
14324 (match_operand:V8HI 2 "register_operand" "v")] 58))]
14325 "TARGET_ALTIVEC"
14326 "vcmpgtuh %0,%1,%2"
14327 [(set_attr "type" "vecsimple")])
14328
14329 (define_insn "altivec_vcmpgtsh"
14330 [(set (match_operand:V8HI 0 "register_operand" "=v")
14331 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
14332 (match_operand:V8HI 2 "register_operand" "v")] 59))]
14333 "TARGET_ALTIVEC"
14334 "vcmpgtsh %0,%1,%2"
14335 [(set_attr "type" "vecsimple")])
14336
14337 (define_insn "altivec_vcmpgtuw"
14338 [(set (match_operand:V4SI 0 "register_operand" "=v")
14339 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
14340 (match_operand:V4SI 2 "register_operand" "v")] 60))]
14341 "TARGET_ALTIVEC"
14342 "vcmpgtuw %0,%1,%2"
14343 [(set_attr "type" "vecsimple")])
14344
14345 (define_insn "altivec_vcmpgtsw"
14346 [(set (match_operand:V4SI 0 "register_operand" "=v")
14347 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
14348 (match_operand:V4SI 2 "register_operand" "v")] 61))]
14349 "TARGET_ALTIVEC"
14350 "vcmpgtsw %0,%1,%2"
14351 [(set_attr "type" "vecsimple")])
14352
14353 (define_insn "altivec_vcmpgtfp"
14354 [(set (match_operand:V4SI 0 "register_operand" "=v")
14355 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
14356 (match_operand:V4SF 2 "register_operand" "v")] 62))]
14357 "TARGET_ALTIVEC"
14358 "vcmpgtfp %0,%1,%2"
14359 [(set_attr "type" "veccmp")])
14360
14361 ;; Fused multiply add
14362 (define_insn "altivec_vmaddfp"
14363 [(set (match_operand:V4SF 0 "register_operand" "=v")
14364 (plus:V4SF (mult:V4SF (match_operand:V4SF 1 "register_operand" "v")
14365 (match_operand:V4SF 2 "register_operand" "v"))
14366 (match_operand:V4SF 3 "register_operand" "v")))]
14367 "TARGET_ALTIVEC"
14368 "vmaddfp %0,%1,%2,%3"
14369 [(set_attr "type" "vecfloat")])
14370
14371 ;; The unspec here is a vec splat of 0. We do multiply as a fused
14372 ;; multiply-add with an add of a 0 vector.
14373
14374 (define_expand "mulv4sf3"
14375 [(set (match_dup 3) (unspec:V4SF [(const_int 0)] 142))
14376 (set (match_operand:V4SF 0 "register_operand" "=v")
14377 (plus:V4SF (mult:V4SF (match_operand:V4SF 1 "register_operand" "v")
14378 (match_operand:V4SF 2 "register_operand" "v"))
14379 (match_dup 3)))]
14380 "TARGET_ALTIVEC && TARGET_FUSED_MADD"
14381 "
14382 { operands[3] = gen_reg_rtx (V4SFmode); }")
14383
14384 ;; Fused multiply subtract
14385 (define_insn "altivec_vnmsubfp"
14386 [(set (match_operand:V4SF 0 "register_operand" "=v")
14387 (minus:V4SF (mult:V4SF (match_operand:V4SF 1 "register_operand" "v")
14388 (match_operand:V4SF 2 "register_operand" "v"))
14389 (match_operand:V4SF 3 "register_operand" "v")))]
14390 "TARGET_ALTIVEC"
14391 "vnmsubfp %0,%1,%2,%3"
14392 [(set_attr "type" "vecfloat")])
14393
14394
14395 (define_insn "altivec_vmsumubm"
14396 [(set (match_operand:V4SI 0 "register_operand" "=v")
14397 (unspec:V4SI [(match_operand:V16QI 1 "register_operand" "v")
14398 (match_operand:V16QI 2 "register_operand" "v")
14399 (match_operand:V4SI 3 "register_operand" "v")] 65))]
14400 "TARGET_ALTIVEC"
14401 "vmsumubm %0, %1, %2, %3"
14402 [(set_attr "type" "veccomplex")])
14403
14404 (define_insn "altivec_vmsummbm"
14405 [(set (match_operand:V4SI 0 "register_operand" "=v")
14406 (unspec:V4SI [(match_operand:V16QI 1 "register_operand" "v")
14407 (match_operand:V16QI 2 "register_operand" "v")
14408 (match_operand:V4SI 3 "register_operand" "v")] 66))]
14409 "TARGET_ALTIVEC"
14410 "vmsumubm %0, %1, %2, %3"
14411 [(set_attr "type" "veccomplex")])
14412
14413 (define_insn "altivec_vmsumuhm"
14414 [(set (match_operand:V4SI 0 "register_operand" "=v")
14415 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
14416 (match_operand:V8HI 2 "register_operand" "v")
14417 (match_operand:V4SI 3 "register_operand" "v")] 67))]
14418 "TARGET_ALTIVEC"
14419 "vmsumuhm %0, %1, %2, %3"
14420 [(set_attr "type" "veccomplex")])
14421
14422 (define_insn "altivec_vmsumshm"
14423 [(set (match_operand:V4SI 0 "register_operand" "=v")
14424 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
14425 (match_operand:V8HI 2 "register_operand" "v")
14426 (match_operand:V4SI 3 "register_operand" "v")] 68))]
14427 "TARGET_ALTIVEC"
14428 "vmsumshm %0, %1, %2, %3"
14429 [(set_attr "type" "veccomplex")])
14430
14431 (define_insn "altivec_vmsumuhs"
14432 [(set (match_operand:V4SI 0 "register_operand" "=v")
14433 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
14434 (match_operand:V8HI 2 "register_operand" "v")
14435 (match_operand:V4SI 3 "register_operand" "v")] 69))]
14436 "TARGET_ALTIVEC"
14437 "vmsumuhs %0, %1, %2, %3"
14438 [(set_attr "type" "veccomplex")])
14439
14440 (define_insn "altivec_vmsumshs"
14441 [(set (match_operand:V4SI 0 "register_operand" "=v")
14442 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
14443 (match_operand:V8HI 2 "register_operand" "v")
14444 (match_operand:V4SI 3 "register_operand" "v")] 70))]
14445 "TARGET_ALTIVEC"
14446 "vmsumshs %0, %1, %2, %3"
14447 [(set_attr "type" "veccomplex")])
14448
14449 (define_insn "umaxv16qi3"
14450 [(set (match_operand:V16QI 0 "register_operand" "=v")
14451 (umax:V16QI (match_operand:V16QI 1 "register_operand" "v")
14452 (match_operand:V16QI 2 "register_operand" "v")))]
14453 "TARGET_ALTIVEC"
14454 "vmaxub %0,%1,%2"
14455 [(set_attr "type" "vecsimple")])
14456
14457 (define_insn "smaxv16qi3"
14458 [(set (match_operand:V16QI 0 "register_operand" "=v")
14459 (smax:V16QI (match_operand:V16QI 1 "register_operand" "v")
14460 (match_operand:V16QI 2 "register_operand" "v")))]
14461 "TARGET_ALTIVEC"
14462 "vmaxsb %0,%1,%2"
14463 [(set_attr "type" "vecsimple")])
14464
14465 (define_insn "umaxv8hi3"
14466 [(set (match_operand:V8HI 0 "register_operand" "=v")
14467 (umax:V8HI (match_operand:V8HI 1 "register_operand" "v")
14468 (match_operand:V8HI 2 "register_operand" "v")))]
14469 "TARGET_ALTIVEC"
14470 "vmaxuh %0,%1,%2"
14471 [(set_attr "type" "vecsimple")])
14472
14473 (define_insn "smaxv8hi3"
14474 [(set (match_operand:V8HI 0 "register_operand" "=v")
14475 (smax:V8HI (match_operand:V8HI 1 "register_operand" "v")
14476 (match_operand:V8HI 2 "register_operand" "v")))]
14477 "TARGET_ALTIVEC"
14478 "vmaxsh %0,%1,%2"
14479 [(set_attr "type" "vecsimple")])
14480
14481 (define_insn "umaxv4si3"
14482 [(set (match_operand:V4SI 0 "register_operand" "=v")
14483 (umax:V4SI (match_operand:V4SI 1 "register_operand" "v")
14484 (match_operand:V4SI 2 "register_operand" "v")))]
14485 "TARGET_ALTIVEC"
14486 "vmaxuw %0,%1,%2"
14487 [(set_attr "type" "vecsimple")])
14488
14489 (define_insn "smaxv4si3"
14490 [(set (match_operand:V4SI 0 "register_operand" "=v")
14491 (smax:V4SI (match_operand:V4SI 1 "register_operand" "v")
14492 (match_operand:V4SI 2 "register_operand" "v")))]
14493 "TARGET_ALTIVEC"
14494 "vmaxsw %0,%1,%2"
14495 [(set_attr "type" "vecsimple")])
14496
14497 (define_insn "smaxv4sf3"
14498 [(set (match_operand:V4SF 0 "register_operand" "=v")
14499 (smax:V4SF (match_operand:V4SF 1 "register_operand" "v")
14500 (match_operand:V4SF 2 "register_operand" "v")))]
14501 "TARGET_ALTIVEC"
14502 "vmaxfp %0,%1,%2"
14503 [(set_attr "type" "veccmp")])
14504
14505 (define_insn "altivec_vmhaddshs"
14506 [(set (match_operand:V8HI 0 "register_operand" "=v")
14507 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
14508 (match_operand:V8HI 2 "register_operand" "v")
14509 (match_operand:V8HI 3 "register_operand" "v")] 71))]
14510 "TARGET_ALTIVEC"
14511 "vmhaddshs %0, %1, %2, %3"
14512 [(set_attr "type" "veccomplex")])
14513 (define_insn "altivec_vmhraddshs"
14514 [(set (match_operand:V8HI 0 "register_operand" "=v")
14515 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
14516 (match_operand:V8HI 2 "register_operand" "v")
14517 (match_operand:V8HI 3 "register_operand" "v")] 72))]
14518 "TARGET_ALTIVEC"
14519 "vmhraddshs %0, %1, %2, %3"
14520 [(set_attr "type" "veccomplex")])
14521 (define_insn "altivec_vmladduhm"
14522 [(set (match_operand:V8HI 0 "register_operand" "=v")
14523 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
14524 (match_operand:V8HI 2 "register_operand" "v")
14525 (match_operand:V8HI 3 "register_operand" "v")] 73))]
14526 "TARGET_ALTIVEC"
14527 "vmladduhm %0, %1, %2, %3"
14528 [(set_attr "type" "veccomplex")])
14529
14530 (define_insn "altivec_vmrghb"
14531 [(set (match_operand:V16QI 0 "register_operand" "=v")
14532 (vec_merge:V16QI (vec_select:V16QI (match_operand:V16QI 1 "register_operand" "v")
14533 (parallel [(const_int 8)
14534 (const_int 9)
14535 (const_int 10)
14536 (const_int 11)
14537 (const_int 12)
14538 (const_int 13)
14539 (const_int 14)
14540 (const_int 15)
14541 (const_int 0)
14542 (const_int 1)
14543 (const_int 2)
14544 (const_int 3)
14545 (const_int 4)
14546 (const_int 5)
14547 (const_int 6)
14548 (const_int 7)]))
14549 (match_operand:V16QI 2 "register_operand" "v")
14550 (const_int 255)))]
14551 "TARGET_ALTIVEC"
14552 "vmrghb %0,%1,%2"
14553 [(set_attr "type" "vecperm")])
14554
14555 (define_insn "altivec_vmrghh"
14556 [(set (match_operand:V8HI 0 "register_operand" "=v")
14557 (vec_merge:V8HI (vec_select:V8HI (match_operand:V8HI 1 "register_operand" "v")
14558 (parallel [(const_int 4)
14559 (const_int 5)
14560 (const_int 6)
14561 (const_int 7)
14562 (const_int 0)
14563 (const_int 1)
14564 (const_int 2)
14565 (const_int 3)]))
14566 (match_operand:V8HI 2 "register_operand" "v")
14567 (const_int 15)))]
14568 "TARGET_ALTIVEC"
14569 "vmrghh %0,%1,%2"
14570 [(set_attr "type" "vecperm")])
14571
14572 (define_insn "altivec_vmrghw"
14573 [(set (match_operand:V4SI 0 "register_operand" "=v")
14574 (vec_merge:V4SI (vec_select:V4SI (match_operand:V4SI 1 "register_operand" "v")
14575 (parallel [(const_int 2)
14576 (const_int 3)
14577 (const_int 0)
14578 (const_int 1)]))
14579 (match_operand:V4SI 2 "register_operand" "v")
14580 (const_int 12)))]
14581 "TARGET_ALTIVEC"
14582 "vmrghw %0,%1,%2"
14583 [(set_attr "type" "vecperm")])
14584
14585 (define_insn "altivec_vmrglb"
14586 [(set (match_operand:V16QI 0 "register_operand" "=v")
14587 (vec_merge:V16QI (vec_select:V16QI (match_operand:V16QI 2 "register_operand" "v")
14588
14589 (parallel [(const_int 0)
14590 (const_int 1)
14591 (const_int 2)
14592 (const_int 3)
14593 (const_int 4)
14594 (const_int 5)
14595 (const_int 6)
14596 (const_int 7)
14597 (const_int 8)
14598 (const_int 9)
14599 (const_int 10)
14600 (const_int 11)
14601 (const_int 12)
14602 (const_int 13)
14603 (const_int 14)
14604 (const_int 15)]))
14605 (match_operand:V16QI 1 "register_operand" "v")
14606 (const_int 255)))]
14607 "TARGET_ALTIVEC"
14608 "vmrglb %0,%1,%2"
14609 [(set_attr "type" "vecperm")])
14610
14611 (define_insn "altivec_vmrglh"
14612 [(set (match_operand:V8HI 0 "register_operand" "=v")
14613 (vec_merge:V8HI (vec_select:V8HI (match_operand:V8HI 2 "register_operand" "v")
14614 (parallel [(const_int 0)
14615 (const_int 1)
14616 (const_int 2)
14617 (const_int 3)
14618 (const_int 4)
14619 (const_int 5)
14620 (const_int 6)
14621 (const_int 7)]))
14622 (match_operand:V8HI 1 "register_operand" "v")
14623 (const_int 15)))]
14624 "TARGET_ALTIVEC"
14625 "vmrglh %0,%1,%2"
14626 [(set_attr "type" "vecperm")])
14627
14628 (define_insn "altivec_vmrglw"
14629 [(set (match_operand:V4SI 0 "register_operand" "=v")
14630 (vec_merge:V4SI (vec_select:V4SI (match_operand:V4SI 2 "register_operand" "v")
14631 (parallel [(const_int 0)
14632 (const_int 1)
14633 (const_int 2)
14634 (const_int 3)]))
14635 (match_operand:V4SI 1 "register_operand" "v")
14636 (const_int 12)))]
14637 "TARGET_ALTIVEC"
14638 "vmrglw %0,%1,%2"
14639 [(set_attr "type" "vecperm")])
14640
14641 (define_insn "uminv16qi3"
14642 [(set (match_operand:V16QI 0 "register_operand" "=v")
14643 (umin:V16QI (match_operand:V16QI 1 "register_operand" "v")
14644 (match_operand:V16QI 2 "register_operand" "v")))]
14645 "TARGET_ALTIVEC"
14646 "vminub %0,%1,%2"
14647 [(set_attr "type" "vecsimple")])
14648
14649 (define_insn "sminv16qi3"
14650 [(set (match_operand:V16QI 0 "register_operand" "=v")
14651 (smin:V16QI (match_operand:V16QI 1 "register_operand" "v")
14652 (match_operand:V16QI 2 "register_operand" "v")))]
14653 "TARGET_ALTIVEC"
14654 "vminsb %0,%1,%2"
14655 [(set_attr "type" "vecsimple")])
14656
14657 (define_insn "uminv8hi3"
14658 [(set (match_operand:V8HI 0 "register_operand" "=v")
14659 (umin:V8HI (match_operand:V8HI 1 "register_operand" "v")
14660 (match_operand:V8HI 2 "register_operand" "v")))]
14661 "TARGET_ALTIVEC"
14662 "vminuh %0,%1,%2"
14663 [(set_attr "type" "vecsimple")])
14664
14665 (define_insn "sminv8hi3"
14666 [(set (match_operand:V8HI 0 "register_operand" "=v")
14667 (smin:V8HI (match_operand:V8HI 1 "register_operand" "v")
14668 (match_operand:V8HI 2 "register_operand" "v")))]
14669 "TARGET_ALTIVEC"
14670 "vminsh %0,%1,%2"
14671 [(set_attr "type" "vecsimple")])
14672
14673 (define_insn "uminv4si3"
14674 [(set (match_operand:V4SI 0 "register_operand" "=v")
14675 (umin:V4SI (match_operand:V4SI 1 "register_operand" "v")
14676 (match_operand:V4SI 2 "register_operand" "v")))]
14677 "TARGET_ALTIVEC"
14678 "vminuw %0,%1,%2"
14679 [(set_attr "type" "vecsimple")])
14680
14681 (define_insn "sminv4si3"
14682 [(set (match_operand:V4SI 0 "register_operand" "=v")
14683 (smin:V4SI (match_operand:V4SI 1 "register_operand" "v")
14684 (match_operand:V4SI 2 "register_operand" "v")))]
14685 "TARGET_ALTIVEC"
14686 "vminsw %0,%1,%2"
14687 [(set_attr "type" "vecsimple")])
14688
14689 (define_insn "sminv4sf3"
14690 [(set (match_operand:V4SF 0 "register_operand" "=v")
14691 (smin:V4SF (match_operand:V4SF 1 "register_operand" "v")
14692 (match_operand:V4SF 2 "register_operand" "v")))]
14693 "TARGET_ALTIVEC"
14694 "vminfp %0,%1,%2"
14695 [(set_attr "type" "veccmp")])
14696
14697 (define_insn "altivec_vmuleub"
14698 [(set (match_operand:V8HI 0 "register_operand" "=v")
14699 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
14700 (match_operand:V16QI 2 "register_operand" "v")] 83))]
14701 "TARGET_ALTIVEC"
14702 "vmuleub %0,%1,%2"
14703 [(set_attr "type" "veccomplex")])
14704
14705 (define_insn "altivec_vmulesb"
14706 [(set (match_operand:V8HI 0 "register_operand" "=v")
14707 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
14708 (match_operand:V16QI 2 "register_operand" "v")] 84))]
14709 "TARGET_ALTIVEC"
14710 "vmulesb %0,%1,%2"
14711 [(set_attr "type" "veccomplex")])
14712
14713 (define_insn "altivec_vmuleuh"
14714 [(set (match_operand:V4SI 0 "register_operand" "=v")
14715 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
14716 (match_operand:V8HI 2 "register_operand" "v")] 85))]
14717 "TARGET_ALTIVEC"
14718 "vmuleuh %0,%1,%2"
14719 [(set_attr "type" "veccomplex")])
14720
14721 (define_insn "altivec_vmulesh"
14722 [(set (match_operand:V4SI 0 "register_operand" "=v")
14723 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
14724 (match_operand:V8HI 2 "register_operand" "v")] 86))]
14725 "TARGET_ALTIVEC"
14726 "vmulesh %0,%1,%2"
14727 [(set_attr "type" "veccomplex")])
14728
14729 (define_insn "altivec_vmuloub"
14730 [(set (match_operand:V8HI 0 "register_operand" "=v")
14731 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
14732 (match_operand:V16QI 2 "register_operand" "v")] 87))]
14733 "TARGET_ALTIVEC"
14734 "vmuloub %0,%1,%2"
14735 [(set_attr "type" "veccomplex")])
14736
14737 (define_insn "altivec_vmulosb"
14738 [(set (match_operand:V8HI 0 "register_operand" "=v")
14739 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
14740 (match_operand:V16QI 2 "register_operand" "v")] 88))]
14741 "TARGET_ALTIVEC"
14742 "vmulosb %0,%1,%2"
14743 [(set_attr "type" "veccomplex")])
14744
14745 (define_insn "altivec_vmulouh"
14746 [(set (match_operand:V4SI 0 "register_operand" "=v")
14747 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
14748 (match_operand:V8HI 2 "register_operand" "v")] 89))]
14749 "TARGET_ALTIVEC"
14750 "vmulouh %0,%1,%2"
14751 [(set_attr "type" "veccomplex")])
14752
14753 (define_insn "altivec_vmulosh"
14754 [(set (match_operand:V4SI 0 "register_operand" "=v")
14755 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
14756 (match_operand:V8HI 2 "register_operand" "v")] 90))]
14757 "TARGET_ALTIVEC"
14758 "vmulosh %0,%1,%2"
14759 [(set_attr "type" "veccomplex")])
14760
14761 (define_insn "altivec_vnor"
14762 [(set (match_operand:V4SI 0 "register_operand" "=v")
14763 (not:V4SI (ior:V4SI (match_operand:V4SI 1 "register_operand" "v")
14764 (match_operand:V4SI 2 "register_operand" "v"))))]
14765 "TARGET_ALTIVEC"
14766 "vnor %0,%1,%2"
14767 [(set_attr "type" "vecsimple")])
14768
14769 (define_insn "iorv4si3"
14770 [(set (match_operand:V4SI 0 "register_operand" "=v")
14771 (ior:V4SI (match_operand:V4SI 1 "register_operand" "v")
14772 (match_operand:V4SI 2 "register_operand" "v")))]
14773 "TARGET_ALTIVEC"
14774 "vor %0,%1,%2"
14775 [(set_attr "type" "vecsimple")])
14776
14777 (define_insn "altivec_vpkuhum"
14778 [(set (match_operand:V16QI 0 "register_operand" "=v")
14779 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
14780 (match_operand:V8HI 2 "register_operand" "v")] 93))]
14781 "TARGET_ALTIVEC"
14782 "vpkuhum %0,%1,%2"
14783 [(set_attr "type" "vecperm")])
14784
14785 (define_insn "altivec_vpkuwum"
14786 [(set (match_operand:V8HI 0 "register_operand" "=v")
14787 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
14788 (match_operand:V4SI 2 "register_operand" "v")] 94))]
14789 "TARGET_ALTIVEC"
14790 "vpkuwum %0,%1,%2"
14791 [(set_attr "type" "vecperm")])
14792
14793 (define_insn "altivec_vpkpx"
14794 [(set (match_operand:V8HI 0 "register_operand" "=v")
14795 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
14796 (match_operand:V4SI 2 "register_operand" "v")] 95))]
14797 "TARGET_ALTIVEC"
14798 "vpkpx %0,%1,%2"
14799 [(set_attr "type" "vecperm")])
14800
14801 (define_insn "altivec_vpkuhss"
14802 [(set (match_operand:V16QI 0 "register_operand" "=v")
14803 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
14804 (match_operand:V8HI 2 "register_operand" "v")] 96))]
14805 "TARGET_ALTIVEC"
14806 "vpkuhss %0,%1,%2"
14807 [(set_attr "type" "vecperm")])
14808
14809 (define_insn "altivec_vpkshss"
14810 [(set (match_operand:V16QI 0 "register_operand" "=v")
14811 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
14812 (match_operand:V8HI 2 "register_operand" "v")] 97))]
14813 "TARGET_ALTIVEC"
14814 "vpkshss %0,%1,%2"
14815 [(set_attr "type" "vecperm")])
14816
14817 (define_insn "altivec_vpkuwss"
14818 [(set (match_operand:V8HI 0 "register_operand" "=v")
14819 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
14820 (match_operand:V4SI 2 "register_operand" "v")] 98))]
14821 "TARGET_ALTIVEC"
14822 "vpkuwss %0,%1,%2"
14823 [(set_attr "type" "vecperm")])
14824
14825 (define_insn "altivec_vpkswss"
14826 [(set (match_operand:V8HI 0 "register_operand" "=v")
14827 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
14828 (match_operand:V4SI 2 "register_operand" "v")] 99))]
14829 "TARGET_ALTIVEC"
14830 "vpkswss %0,%1,%2"
14831 [(set_attr "type" "vecperm")])
14832
14833 (define_insn "altivec_vpkuhus"
14834 [(set (match_operand:V16QI 0 "register_operand" "=v")
14835 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
14836 (match_operand:V8HI 2 "register_operand" "v")] 100))]
14837 "TARGET_ALTIVEC"
14838 "vpkuhus %0,%1,%2"
14839 [(set_attr "type" "vecperm")])
14840
14841 (define_insn "altivec_vpkshus"
14842 [(set (match_operand:V16QI 0 "register_operand" "=v")
14843 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
14844 (match_operand:V8HI 2 "register_operand" "v")] 101))]
14845 "TARGET_ALTIVEC"
14846 "vpkshus %0,%1,%2"
14847 [(set_attr "type" "vecperm")])
14848
14849 (define_insn "altivec_vpkuwus"
14850 [(set (match_operand:V8HI 0 "register_operand" "=v")
14851 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
14852 (match_operand:V4SI 2 "register_operand" "v")] 102))]
14853 "TARGET_ALTIVEC"
14854 "vpkuwus %0,%1,%2"
14855 [(set_attr "type" "vecperm")])
14856
14857 (define_insn "altivec_vpkswus"
14858 [(set (match_operand:V8HI 0 "register_operand" "=v")
14859 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
14860 (match_operand:V4SI 2 "register_operand" "v")] 103))]
14861 "TARGET_ALTIVEC"
14862 "vpkswus %0,%1,%2"
14863 [(set_attr "type" "vecperm")])
14864
14865 (define_insn "altivec_vrlb"
14866 [(set (match_operand:V16QI 0 "register_operand" "=v")
14867 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
14868 (match_operand:V16QI 2 "register_operand" "v")] 104))]
14869 "TARGET_ALTIVEC"
14870 "vrlb %0,%1,%2"
14871 [(set_attr "type" "vecsimple")])
14872
14873 (define_insn "altivec_vrlh"
14874 [(set (match_operand:V8HI 0 "register_operand" "=v")
14875 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
14876 (match_operand:V8HI 2 "register_operand" "v")] 105))]
14877 "TARGET_ALTIVEC"
14878 "vrlh %0,%1,%2"
14879 [(set_attr "type" "vecsimple")])
14880
14881 (define_insn "altivec_vrlw"
14882 [(set (match_operand:V4SI 0 "register_operand" "=v")
14883 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
14884 (match_operand:V4SI 2 "register_operand" "v")] 106))]
14885 "TARGET_ALTIVEC"
14886 "vrlw %0,%1,%2"
14887 [(set_attr "type" "vecsimple")])
14888
14889 (define_insn "altivec_vslb"
14890 [(set (match_operand:V16QI 0 "register_operand" "=v")
14891 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
14892 (match_operand:V16QI 2 "register_operand" "v")] 107))]
14893 "TARGET_ALTIVEC"
14894 "vslb %0,%1,%2"
14895 [(set_attr "type" "vecsimple")])
14896
14897 (define_insn "altivec_vslh"
14898 [(set (match_operand:V8HI 0 "register_operand" "=v")
14899 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
14900 (match_operand:V8HI 2 "register_operand" "v")] 108))]
14901 "TARGET_ALTIVEC"
14902 "vslh %0,%1,%2"
14903 [(set_attr "type" "vecsimple")])
14904
14905 (define_insn "altivec_vslw"
14906 [(set (match_operand:V4SI 0 "register_operand" "=v")
14907 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
14908 (match_operand:V4SI 2 "register_operand" "v")] 109))]
14909 "TARGET_ALTIVEC"
14910 "vslw %0,%1,%2"
14911 [(set_attr "type" "vecsimple")])
14912
14913 (define_insn "altivec_vsl"
14914 [(set (match_operand:V4SI 0 "register_operand" "=v")
14915 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
14916 (match_operand:V4SI 2 "register_operand" "v")] 110))]
14917 "TARGET_ALTIVEC"
14918 "vsl %0,%1,%2"
14919 [(set_attr "type" "vecperm")])
14920
14921 (define_insn "altivec_vslo"
14922 [(set (match_operand:V4SI 0 "register_operand" "=v")
14923 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
14924 (match_operand:V4SI 2 "register_operand" "v")] 111))]
14925 "TARGET_ALTIVEC"
14926 "vslo %0,%1,%2"
14927 [(set_attr "type" "vecperm")])
14928
14929 (define_insn "altivec_vsrb"
14930 [(set (match_operand:V16QI 0 "register_operand" "=v")
14931 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
14932 (match_operand:V16QI 2 "register_operand" "v")] 112))]
14933 "TARGET_ALTIVEC"
14934 "vsrb %0,%1,%2"
14935 [(set_attr "type" "vecsimple")])
14936
14937 (define_insn "altivec_vsrh"
14938 [(set (match_operand:V8HI 0 "register_operand" "=v")
14939 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
14940 (match_operand:V8HI 2 "register_operand" "v")] 113))]
14941 "TARGET_ALTIVEC"
14942 "vsrh %0,%1,%2"
14943 [(set_attr "type" "vecsimple")])
14944
14945 (define_insn "altivec_vsrw"
14946 [(set (match_operand:V4SI 0 "register_operand" "=v")
14947 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
14948 (match_operand:V4SI 2 "register_operand" "v")] 114))]
14949 "TARGET_ALTIVEC"
14950 "vsrw %0,%1,%2"
14951 [(set_attr "type" "vecsimple")])
14952
14953 (define_insn "altivec_vsrab"
14954 [(set (match_operand:V16QI 0 "register_operand" "=v")
14955 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
14956 (match_operand:V16QI 2 "register_operand" "v")] 115))]
14957 "TARGET_ALTIVEC"
14958 "vsrab %0,%1,%2"
14959 [(set_attr "type" "vecsimple")])
14960
14961 (define_insn "altivec_vsrah"
14962 [(set (match_operand:V8HI 0 "register_operand" "=v")
14963 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
14964 (match_operand:V8HI 2 "register_operand" "v")] 116))]
14965 "TARGET_ALTIVEC"
14966 "vsrah %0,%1,%2"
14967 [(set_attr "type" "vecsimple")])
14968
14969 (define_insn "altivec_vsraw"
14970 [(set (match_operand:V4SI 0 "register_operand" "=v")
14971 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
14972 (match_operand:V4SI 2 "register_operand" "v")] 117))]
14973 "TARGET_ALTIVEC"
14974 "vsraw %0,%1,%2"
14975 [(set_attr "type" "vecsimple")])
14976
14977 (define_insn "altivec_vsr"
14978 [(set (match_operand:V4SI 0 "register_operand" "=v")
14979 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
14980 (match_operand:V4SI 2 "register_operand" "v")] 118))]
14981 "TARGET_ALTIVEC"
14982 "vsr %0,%1,%2"
14983 [(set_attr "type" "vecperm")])
14984
14985 (define_insn "altivec_vsro"
14986 [(set (match_operand:V4SI 0 "register_operand" "=v")
14987 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
14988 (match_operand:V4SI 2 "register_operand" "v")] 119))]
14989 "TARGET_ALTIVEC"
14990 "vsro %0,%1,%2"
14991 [(set_attr "type" "vecperm")])
14992
14993 (define_insn "subv16qi3"
14994 [(set (match_operand:V16QI 0 "register_operand" "=v")
14995 (minus:V16QI (match_operand:V16QI 1 "register_operand" "v")
14996 (match_operand:V16QI 2 "register_operand" "v")))]
14997 "TARGET_ALTIVEC"
14998 "vsububm %0,%1,%2"
14999 [(set_attr "type" "vecsimple")])
15000
15001 (define_insn "subv8hi3"
15002 [(set (match_operand:V8HI 0 "register_operand" "=v")
15003 (minus:V8HI (match_operand:V8HI 1 "register_operand" "v")
15004 (match_operand:V8HI 2 "register_operand" "v")))]
15005 "TARGET_ALTIVEC"
15006 "vsubuhm %0,%1,%2"
15007 [(set_attr "type" "vecsimple")])
15008
15009 (define_insn "subv4si3"
15010 [(set (match_operand:V4SI 0 "register_operand" "=v")
15011 (minus:V4SI (match_operand:V4SI 1 "register_operand" "v")
15012 (match_operand:V4SI 2 "register_operand" "v")))]
15013 "TARGET_ALTIVEC"
15014 "vsubuwm %0,%1,%2"
15015 [(set_attr "type" "vecsimple")])
15016
15017 (define_insn "subv4sf3"
15018 [(set (match_operand:V4SF 0 "register_operand" "=v")
15019 (minus:V4SF (match_operand:V4SF 1 "register_operand" "v")
15020 (match_operand:V4SF 2 "register_operand" "v")))]
15021 "TARGET_ALTIVEC"
15022 "vsubfp %0,%1,%2"
15023 [(set_attr "type" "vecfloat")])
15024
15025 (define_insn "altivec_vsubcuw"
15026 [(set (match_operand:V4SI 0 "register_operand" "=v")
15027 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
15028 (match_operand:V4SI 2 "register_operand" "v")] 124))]
15029 "TARGET_ALTIVEC"
15030 "vsubcuw %0,%1,%2"
15031 [(set_attr "type" "vecsimple")])
15032
15033 (define_insn "altivec_vsububs"
15034 [(set (match_operand:V16QI 0 "register_operand" "=v")
15035 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
15036 (match_operand:V16QI 2 "register_operand" "v")] 125))]
15037 "TARGET_ALTIVEC"
15038 "vsububs %0,%1,%2"
15039 [(set_attr "type" "vecsimple")])
15040
15041 (define_insn "altivec_vsubsbs"
15042 [(set (match_operand:V16QI 0 "register_operand" "=v")
15043 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
15044 (match_operand:V16QI 2 "register_operand" "v")] 126))]
15045 "TARGET_ALTIVEC"
15046 "vsubsbs %0,%1,%2"
15047 [(set_attr "type" "vecsimple")])
15048
15049 (define_insn "altivec_vsubuhs"
15050 [(set (match_operand:V8HI 0 "register_operand" "=v")
15051 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
15052 (match_operand:V8HI 2 "register_operand" "v")] 127))]
15053 "TARGET_ALTIVEC"
15054 "vsubuhs %0,%1,%2"
15055 [(set_attr "type" "vecsimple")])
15056
15057 (define_insn "altivec_vsubshs"
15058 [(set (match_operand:V8HI 0 "register_operand" "=v")
15059 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
15060 (match_operand:V8HI 2 "register_operand" "v")] 128))]
15061 "TARGET_ALTIVEC"
15062 "vsubshs %0,%1,%2"
15063 [(set_attr "type" "vecsimple")])
15064
15065 (define_insn "altivec_vsubuws"
15066 [(set (match_operand:V4SI 0 "register_operand" "=v")
15067 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
15068 (match_operand:V4SI 2 "register_operand" "v")] 129))]
15069 "TARGET_ALTIVEC"
15070 "vsubuws %0,%1,%2"
15071 [(set_attr "type" "vecsimple")])
15072
15073 (define_insn "altivec_vsubsws"
15074 [(set (match_operand:V4SI 0 "register_operand" "=v")
15075 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
15076 (match_operand:V4SI 2 "register_operand" "v")] 130))]
15077 "TARGET_ALTIVEC"
15078 "vsubsws %0,%1,%2"
15079 [(set_attr "type" "vecsimple")])
15080
15081 (define_insn "altivec_vsum4ubs"
15082 [(set (match_operand:V4SI 0 "register_operand" "=v")
15083 (unspec:V4SI [(match_operand:V16QI 1 "register_operand" "v")
15084 (match_operand:V4SI 2 "register_operand" "v")] 131))]
15085 "TARGET_ALTIVEC"
15086 "vsum4ubs %0,%1,%2"
15087 [(set_attr "type" "veccomplex")])
15088
15089 (define_insn "altivec_vsum4sbs"
15090 [(set (match_operand:V4SI 0 "register_operand" "=v")
15091 (unspec:V4SI [(match_operand:V16QI 1 "register_operand" "v")
15092 (match_operand:V4SI 2 "register_operand" "v")] 132))]
15093 "TARGET_ALTIVEC"
15094 "vsum4sbs %0,%1,%2"
15095 [(set_attr "type" "veccomplex")])
15096
15097 (define_insn "altivec_vsum4shs"
15098 [(set (match_operand:V4SI 0 "register_operand" "=v")
15099 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
15100 (match_operand:V4SI 2 "register_operand" "v")] 133))]
15101 "TARGET_ALTIVEC"
15102 "vsum4shs %0,%1,%2"
15103 [(set_attr "type" "veccomplex")])
15104
15105 (define_insn "altivec_vsum2sws"
15106 [(set (match_operand:V4SI 0 "register_operand" "=v")
15107 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
15108 (match_operand:V4SI 2 "register_operand" "v")] 134))]
15109 "TARGET_ALTIVEC"
15110 "vsum2sws %0,%1,%2"
15111 [(set_attr "type" "veccomplex")])
15112
15113 (define_insn "altivec_vsumsws"
15114 [(set (match_operand:V4SI 0 "register_operand" "=v")
15115 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
15116 (match_operand:V4SI 2 "register_operand" "v")] 135))]
15117 "TARGET_ALTIVEC"
15118 "vsumsws %0,%1,%2"
15119 [(set_attr "type" "veccomplex")])
15120
15121 (define_insn "xorv4si3"
15122 [(set (match_operand:V4SI 0 "register_operand" "=v")
15123 (xor:V4SI (match_operand:V4SI 1 "register_operand" "v")
15124 (match_operand:V4SI 2 "register_operand" "v")))]
15125 "TARGET_ALTIVEC"
15126 "vxor %0,%1,%2"
15127 [(set_attr "type" "vecsimple")])
15128
15129 (define_insn "altivec_vspltb"
15130 [(set (match_operand:V16QI 0 "register_operand" "=v")
15131 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
15132 (match_operand:QI 2 "immediate_operand" "i")] 136))]
15133 "TARGET_ALTIVEC"
15134 "vspltb %0,%1,%2"
15135 [(set_attr "type" "vecperm")])
15136
15137 (define_insn "altivec_vsplth"
15138 [(set (match_operand:V8HI 0 "register_operand" "=v")
15139 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
15140 (match_operand:QI 2 "immediate_operand" "i")] 137))]
15141 "TARGET_ALTIVEC"
15142 "vsplth %0,%1,%2"
15143 [(set_attr "type" "vecperm")])
15144
15145 (define_insn "altivec_vspltw"
15146 [(set (match_operand:V4SI 0 "register_operand" "=v")
15147 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
15148 (match_operand:QI 2 "immediate_operand" "i")] 138))]
15149 "TARGET_ALTIVEC"
15150 "vspltw %0,%1,%2"
15151 [(set_attr "type" "vecperm")])
15152
15153 (define_insn "altivec_vspltisb"
15154 [(set (match_operand:V16QI 0 "register_operand" "=v")
15155 (unspec:V16QI [(match_operand:QI 1 "immediate_operand" "i")] 139))]
15156 "TARGET_ALTIVEC"
15157 "vspltisb %0, %1"
15158 [(set_attr "type" "vecsimple")])
15159
15160
15161 (define_insn "altivec_vspltish"
15162 [(set (match_operand:V8HI 0 "register_operand" "=v")
15163 (unspec:V8HI [(match_operand:QI 1 "immediate_operand" "i")] 140))]
15164 "TARGET_ALTIVEC"
15165 "vspltish %0, %1"
15166 [(set_attr "type" "vecsimple")])
15167
15168 (define_insn "altivec_vspltisw"
15169 [(set (match_operand:V4SI 0 "register_operand" "=v")
15170 (unspec:V4SI [(match_operand:QI 1 "immediate_operand" "i")] 141))]
15171 "TARGET_ALTIVEC"
15172 "vspltisw %0, %1"
15173 [(set_attr "type" "vecsimple")])
15174
15175 (define_insn ""
15176 [(set (match_operand:V4SF 0 "register_operand" "=v")
15177 (unspec:V4SF [(match_operand:QI 1 "immediate_operand" "i")] 142))]
15178 "TARGET_ALTIVEC"
15179 "vspltisw %0, %1"
15180 [(set_attr "type" "vecsimple")])
15181
15182 (define_insn "ftruncv4sf2"
15183 [(set (match_operand:V4SF 0 "register_operand" "=v")
15184 (fix:V4SF (match_operand:V4SF 1 "register_operand" "v")))]
15185 "TARGET_ALTIVEC"
15186 "vrfiz %0, %1"
15187 [(set_attr "type" "vecfloat")])
15188
15189 (define_insn "altivec_vperm_4si"
15190 [(set (match_operand:V4SI 0 "register_operand" "=v")
15191 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
15192 (match_operand:V4SI 2 "register_operand" "v")
15193 (match_operand:V16QI 3 "register_operand" "v")] 144))]
15194 "TARGET_ALTIVEC"
15195 "vperm %0,%1,%2,%3"
15196 [(set_attr "type" "vecperm")])
15197
15198 (define_insn "altivec_vperm_4sf"
15199 [(set (match_operand:V4SF 0 "register_operand" "=v")
15200 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")
15201 (match_operand:V4SF 2 "register_operand" "v")
15202 (match_operand:V16QI 3 "register_operand" "v")] 145))]
15203 "TARGET_ALTIVEC"
15204 "vperm %0,%1,%2,%3"
15205 [(set_attr "type" "vecperm")])
15206
15207 (define_insn "altivec_vperm_8hi"
15208 [(set (match_operand:V8HI 0 "register_operand" "=v")
15209 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
15210 (match_operand:V8HI 2 "register_operand" "v")
15211 (match_operand:V16QI 3 "register_operand" "v")] 146))]
15212 "TARGET_ALTIVEC"
15213 "vperm %0,%1,%2,%3"
15214 [(set_attr "type" "vecperm")])
15215
15216 (define_insn "altivec_vperm_16qi"
15217 [(set (match_operand:V16QI 0 "register_operand" "=v")
15218 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
15219 (match_operand:V16QI 2 "register_operand" "v")
15220 (match_operand:V16QI 3 "register_operand" "v")] 147))]
15221 "TARGET_ALTIVEC"
15222 "vperm %0,%1,%2,%3"
15223 [(set_attr "type" "vecperm")])
15224
15225 (define_insn "altivec_vrfip"
15226 [(set (match_operand:V4SF 0 "register_operand" "=v")
15227 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")] 148))]
15228 "TARGET_ALTIVEC"
15229 "vrfip %0, %1"
15230 [(set_attr "type" "vecfloat")])
15231
15232 (define_insn "altivec_vrfin"
15233 [(set (match_operand:V4SF 0 "register_operand" "=v")
15234 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")] 149))]
15235 "TARGET_ALTIVEC"
15236 "vrfin %0, %1"
15237 [(set_attr "type" "vecfloat")])
15238
15239 (define_insn "altivec_vrfim"
15240 [(set (match_operand:V4SF 0 "register_operand" "=v")
15241 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")] 150))]
15242 "TARGET_ALTIVEC"
15243 "vrfim %0, %1"
15244 [(set_attr "type" "vecfloat")])
15245
15246 (define_insn "altivec_vcfux"
15247 [(set (match_operand:V4SF 0 "register_operand" "=v")
15248 (unspec:V4SF [(match_operand:V4SI 1 "register_operand" "v")
15249 (match_operand:QI 2 "immediate_operand" "i")] 151))]
15250 "TARGET_ALTIVEC"
15251 "vcfux %0, %1, %2"
15252 [(set_attr "type" "vecfloat")])
15253
15254 (define_insn "altivec_vcfsx"
15255 [(set (match_operand:V4SF 0 "register_operand" "=v")
15256 (unspec:V4SF [(match_operand:V4SI 1 "register_operand" "v")
15257 (match_operand:QI 2 "immediate_operand" "i")] 152))]
15258 "TARGET_ALTIVEC"
15259 "vcfsx %0, %1, %2"
15260 [(set_attr "type" "vecfloat")])
15261
15262 (define_insn "altivec_vctuxs"
15263 [(set (match_operand:V4SI 0 "register_operand" "=v")
15264 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
15265 (match_operand:QI 2 "immediate_operand" "i")] 153))]
15266 "TARGET_ALTIVEC"
15267 "vctuxs %0, %1, %2"
15268 [(set_attr "type" "vecfloat")])
15269
15270 (define_insn "altivec_vctsxs"
15271 [(set (match_operand:V4SI 0 "register_operand" "=v")
15272 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
15273 (match_operand:QI 2 "immediate_operand" "i")] 154))]
15274 "TARGET_ALTIVEC"
15275 "vctsxs %0, %1, %2"
15276 [(set_attr "type" "vecfloat")])
15277
15278 (define_insn "altivec_vlogefp"
15279 [(set (match_operand:V4SF 0 "register_operand" "=v")
15280 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")] 155))]
15281 "TARGET_ALTIVEC"
15282 "vlogefp %0, %1"
15283 [(set_attr "type" "vecfloat")])
15284
15285 (define_insn "altivec_vexptefp"
15286 [(set (match_operand:V4SF 0 "register_operand" "=v")
15287 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")] 156))]
15288 "TARGET_ALTIVEC"
15289 "vexptefp %0, %1"
15290 [(set_attr "type" "vecfloat")])
15291
15292 (define_insn "altivec_vrsqrtefp"
15293 [(set (match_operand:V4SF 0 "register_operand" "=v")
15294 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")] 157))]
15295 "TARGET_ALTIVEC"
15296 "vrsqrtefp %0, %1"
15297 [(set_attr "type" "vecfloat")])
15298
15299 (define_insn "altivec_vrefp"
15300 [(set (match_operand:V4SF 0 "register_operand" "=v")
15301 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")] 158))]
15302 "TARGET_ALTIVEC"
15303 "vrefp %0, %1"
15304 [(set_attr "type" "vecfloat")])
15305
15306 (define_insn "altivec_vsel_4si"
15307 [(set (match_operand:V4SI 0 "register_operand" "=v")
15308 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
15309 (match_operand:V4SI 2 "register_operand" "v")
15310 (match_operand:V4SI 3 "register_operand" "v")] 159))]
15311 "TARGET_ALTIVEC"
15312 "vsel %0,%1,%2,%3"
15313 [(set_attr "type" "vecperm")])
15314
15315 (define_insn "altivec_vsel_4sf"
15316 [(set (match_operand:V4SF 0 "register_operand" "=v")
15317 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")
15318 (match_operand:V4SF 2 "register_operand" "v")
15319 (match_operand:V4SI 3 "register_operand" "v")] 160))]
15320 "TARGET_ALTIVEC"
15321 "vsel %0,%1,%2,%3"
15322 [(set_attr "type" "vecperm")])
15323
15324 (define_insn "altivec_vsel_8hi"
15325 [(set (match_operand:V8HI 0 "register_operand" "=v")
15326 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
15327 (match_operand:V8HI 2 "register_operand" "v")
15328 (match_operand:V8HI 3 "register_operand" "v")] 161))]
15329 "TARGET_ALTIVEC"
15330 "vsel %0,%1,%2,%3"
15331 [(set_attr "type" "vecperm")])
15332
15333 (define_insn "altivec_vsel_16qi"
15334 [(set (match_operand:V16QI 0 "register_operand" "=v")
15335 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
15336 (match_operand:V16QI 2 "register_operand" "v")
15337 (match_operand:V16QI 3 "register_operand" "v")] 162))]
15338 "TARGET_ALTIVEC"
15339 "vsel %0,%1,%2,%3"
15340 [(set_attr "type" "vecperm")])
15341
15342 (define_insn "altivec_vsldoi_4si"
15343 [(set (match_operand:V4SI 0 "register_operand" "=v")
15344 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
15345 (match_operand:V4SI 2 "register_operand" "v")
15346 (match_operand:QI 3 "immediate_operand" "i")] 163))]
15347 "TARGET_ALTIVEC"
15348 "vsldoi %0, %1, %2, %3"
15349 [(set_attr "type" "vecperm")])
15350
15351 (define_insn "altivec_vsldoi_4sf"
15352 [(set (match_operand:V4SF 0 "register_operand" "=v")
15353 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")
15354 (match_operand:V4SF 2 "register_operand" "v")
15355 (match_operand:QI 3 "immediate_operand" "i")] 164))]
15356 "TARGET_ALTIVEC"
15357 "vsldoi %0, %1, %2, %3"
15358 [(set_attr "type" "vecperm")])
15359
15360 (define_insn "altivec_vsldoi_8hi"
15361 [(set (match_operand:V8HI 0 "register_operand" "=v")
15362 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
15363 (match_operand:V8HI 2 "register_operand" "v")
15364 (match_operand:QI 3 "immediate_operand" "i")] 165))]
15365 "TARGET_ALTIVEC"
15366 "vsldoi %0, %1, %2, %3"
15367 [(set_attr "type" "vecperm")])
15368
15369 (define_insn "altivec_vsldoi_16qi"
15370 [(set (match_operand:V16QI 0 "register_operand" "=v")
15371 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
15372 (match_operand:V16QI 2 "register_operand" "v")
15373 (match_operand:QI 3 "immediate_operand" "i")] 166))]
15374 "TARGET_ALTIVEC"
15375 "vsldoi %0, %1, %2, %3"
15376 [(set_attr "type" "vecperm")])
15377
15378 (define_insn "altivec_vupkhsb"
15379 [(set (match_operand:V8HI 0 "register_operand" "=v")
15380 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")] 167))]
15381 "TARGET_ALTIVEC"
15382 "vupkhsb %0, %1"
15383 [(set_attr "type" "vecperm")])
15384
15385 (define_insn "altivec_vupkhpx"
15386 [(set (match_operand:V4SI 0 "register_operand" "=v")
15387 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")] 168))]
15388 "TARGET_ALTIVEC"
15389 "vupkhpx %0, %1"
15390 [(set_attr "type" "vecperm")])
15391
15392 (define_insn "altivec_vupkhsh"
15393 [(set (match_operand:V4SI 0 "register_operand" "=v")
15394 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")] 169))]
15395 "TARGET_ALTIVEC"
15396 "vupkhsh %0, %1"
15397 [(set_attr "type" "vecperm")])
15398
15399 (define_insn "altivec_vupklsb"
15400 [(set (match_operand:V8HI 0 "register_operand" "=v")
15401 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")] 170))]
15402 "TARGET_ALTIVEC"
15403 "vupklsb %0, %1"
15404 [(set_attr "type" "vecperm")])
15405
15406 (define_insn "altivec_vupklpx"
15407 [(set (match_operand:V4SI 0 "register_operand" "=v")
15408 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")] 171))]
15409 "TARGET_ALTIVEC"
15410 "vupklpx %0, %1"
15411 [(set_attr "type" "vecperm")])
15412
15413 (define_insn "altivec_vupklsh"
15414 [(set (match_operand:V4SI 0 "register_operand" "=v")
15415 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")] 172))]
15416 "TARGET_ALTIVEC"
15417 "vupklsh %0, %1"
15418 [(set_attr "type" "vecperm")])
15419
15420 ;; AltiVec predicates.
15421
15422 (define_expand "cr6_test_for_zero"
15423 [(set (match_operand:SI 0 "register_operand" "=r")
15424 (eq:SI (reg:CC 74)
15425 (const_int 0)))]
15426 "TARGET_ALTIVEC"
15427 "")
15428
15429 (define_expand "cr6_test_for_zero_reverse"
15430 [(set (match_operand:SI 0 "register_operand" "=r")
15431 (eq:SI (reg:CC 74)
15432 (const_int 0)))
15433 (set (match_dup 0) (minus:SI (const_int 1) (match_dup 0)))]
15434 "TARGET_ALTIVEC"
15435 "")
15436
15437 (define_expand "cr6_test_for_lt"
15438 [(set (match_operand:SI 0 "register_operand" "=r")
15439 (lt:SI (reg:CC 74)
15440 (const_int 0)))]
15441 "TARGET_ALTIVEC"
15442 "")
15443
15444 (define_expand "cr6_test_for_lt_reverse"
15445 [(set (match_operand:SI 0 "register_operand" "=r")
15446 (lt:SI (reg:CC 74)
15447 (const_int 0)))
15448 (set (match_dup 0) (minus:SI (const_int 1) (match_dup 0)))]
15449 "TARGET_ALTIVEC"
15450 "")
15451
15452 ;; We can get away with generating the opcode on the fly (%3 below)
15453 ;; because all the predicates have the same scheduling parameters.
15454
15455 (define_insn "altivec_predicate_v4si"
15456 [(set (reg:CC 74)
15457 (unspec:CC [(match_operand:V4SI 1 "register_operand" "v")
15458 (match_operand:V4SI 2 "register_operand" "v")
15459 (match_operand 3 "any_operand" "")] 173))
15460 (clobber (match_scratch:V4SI 0 "=v"))]
15461 "TARGET_ALTIVEC"
15462 "%3 %0,%1,%2"
15463 [(set_attr "type" "veccmp")])
15464
15465 (define_insn "altivec_predicate_v4sf"
15466 [(set (reg:CC 74)
15467 (unspec:CC [(match_operand:V4SF 1 "register_operand" "v")
15468 (match_operand:V4SF 2 "register_operand" "v")
15469 (match_operand 3 "any_operand" "")] 174))
15470 (clobber (match_scratch:V4SF 0 "=v"))]
15471 "TARGET_ALTIVEC"
15472 "%3 %0,%1,%2"
15473 [(set_attr "type" "veccmp")])
15474
15475 (define_insn "altivec_predicate_v8hi"
15476 [(set (reg:CC 74)
15477 (unspec:CC [(match_operand:V8HI 1 "register_operand" "v")
15478 (match_operand:V8HI 2 "register_operand" "v")
15479 (match_operand 3 "any_operand" "")] 175))
15480 (clobber (match_scratch:V8HI 0 "=v"))]
15481 "TARGET_ALTIVEC"
15482 "%3 %0,%1,%2"
15483 [(set_attr "type" "veccmp")])
15484
15485 (define_insn "altivec_predicate_v16qi"
15486 [(set (reg:CC 74)
15487 (unspec:CC [(match_operand:V16QI 1 "register_operand" "v")
15488 (match_operand:V16QI 2 "register_operand" "v")
15489 (match_operand 3 "any_operand" "")] 175))
15490 (clobber (match_scratch:V16QI 0 "=v"))]
15491 "TARGET_ALTIVEC"
15492 "%3 %0,%1,%2"
15493 [(set_attr "type" "veccmp")])
15494
15495 (define_insn "altivec_mtvscr"
15496 [(unspec_volatile [(match_operand:V4SI 0 "register_operand" "v")] 186)]
15497 "TARGET_ALTIVEC"
15498 "mtvscr %0"
15499 [(set_attr "type" "vecsimple")])
15500
15501 (define_insn "altivec_mfvscr"
15502 [(set (match_operand:V8HI 0 "register_operand" "=v")
15503 (unspec_volatile:V8HI [(const_int 0)] 187))]
15504 "TARGET_ALTIVEC"
15505 "mfvscr %0"
15506 [(set_attr "type" "vecsimple")])
15507
15508 (define_insn "altivec_dssall"
15509 [(unspec [(const_int 0)] 188)]
15510 "TARGET_ALTIVEC"
15511 "dssall"
15512 [(set_attr "type" "vecsimple")])
15513
15514 (define_insn "altivec_dss"
15515 [(unspec [(match_operand:QI 0 "immediate_operand" "i")] 189)]
15516 "TARGET_ALTIVEC"
15517 "dss %0"
15518 [(set_attr "type" "vecsimple")])
15519
15520 (define_insn "altivec_dst"
15521 [(unspec [(match_operand:SI 0 "register_operand" "b")
15522 (match_operand:SI 1 "register_operand" "r")
15523 (match_operand:QI 2 "immediate_operand" "i")] 190)]
15524 "TARGET_ALTIVEC"
15525 "dst %0,%1,%2"
15526 [(set_attr "type" "vecsimple")])
15527
15528 (define_insn "altivec_dstt"
15529 [(unspec [(match_operand:SI 0 "register_operand" "b")
15530 (match_operand:SI 1 "register_operand" "r")
15531 (match_operand:QI 2 "immediate_operand" "i")] 191)]
15532 "TARGET_ALTIVEC"
15533 "dstt %0,%1,%2"
15534 [(set_attr "type" "vecsimple")])
15535
15536 (define_insn "altivec_dstst"
15537 [(unspec [(match_operand:SI 0 "register_operand" "b")
15538 (match_operand:SI 1 "register_operand" "r")
15539 (match_operand:QI 2 "immediate_operand" "i")] 192)]
15540 "TARGET_ALTIVEC"
15541 "dstst %0,%1,%2"
15542 [(set_attr "type" "vecsimple")])
15543
15544 (define_insn "altivec_dststt"
15545 [(unspec [(match_operand:SI 0 "register_operand" "b")
15546 (match_operand:SI 1 "register_operand" "r")
15547 (match_operand:QI 2 "immediate_operand" "i")] 193)]
15548 "TARGET_ALTIVEC"
15549 "dststt %0,%1,%2"
15550 [(set_attr "type" "vecsimple")])
15551
15552 (define_insn "altivec_lvsl"
15553 [(set (match_operand:V16QI 0 "register_operand" "=v")
15554 (unspec:V16QI [(match_operand:SI 1 "register_operand" "b")
15555 (match_operand:SI 2 "register_operand" "r")] 194))]
15556 "TARGET_ALTIVEC"
15557 "lvsl %0,%1,%2"
15558 [(set_attr "type" "vecload")])
15559
15560 (define_insn "altivec_lvsr"
15561 [(set (match_operand:V16QI 0 "register_operand" "=v")
15562 (unspec:V16QI [(match_operand:SI 1 "register_operand" "b")
15563 (match_operand:SI 2 "register_operand" "r")] 195))]
15564 "TARGET_ALTIVEC"
15565 "lvsr %0,%1,%2"
15566 [(set_attr "type" "vecload")])
15567
15568 ;; Parallel some of the LVE* and STV*'s with unspecs because some have
15569 ;; identical rtl but different instructions-- and gcc gets confused.
15570
15571 (define_insn "altivec_lvebx"
15572 [(parallel
15573 [(set (match_operand:V16QI 0 "register_operand" "=v")
15574 (mem:V16QI (plus:SI (match_operand:SI 1 "register_operand" "b")
15575 (match_operand:SI 2 "register_operand" "r"))))
15576 (unspec [(const_int 0)] 196)])]
15577 "TARGET_ALTIVEC"
15578 "lvebx %0,%1,%2"
15579 [(set_attr "type" "vecload")])
15580
15581 (define_insn "altivec_lvehx"
15582 [(parallel
15583 [(set (match_operand:V8HI 0 "register_operand" "=v")
15584 (mem:V8HI
15585 (and:SI (plus:SI (match_operand:SI 1 "register_operand" "b")
15586 (match_operand:SI 2 "register_operand" "r"))
15587 (const_int -2))))
15588 (unspec [(const_int 0)] 197)])]
15589 "TARGET_ALTIVEC"
15590 "lvehx %0,%1,%2"
15591 [(set_attr "type" "vecload")])
15592
15593 (define_insn "altivec_lvewx"
15594 [(parallel
15595 [(set (match_operand:V4SI 0 "register_operand" "=v")
15596 (mem:V4SI
15597 (and:SI (plus:SI (match_operand:SI 1 "register_operand" "b")
15598 (match_operand:SI 2 "register_operand" "r"))
15599 (const_int -4))))
15600 (unspec [(const_int 0)] 198)])]
15601 "TARGET_ALTIVEC"
15602 "lvewx %0,%1,%2"
15603 [(set_attr "type" "vecload")])
15604
15605 (define_insn "altivec_lvxl"
15606 [(parallel
15607 [(set (match_operand:V4SI 0 "register_operand" "=v")
15608 (mem:V4SI (plus:SI (match_operand:SI 1 "register_operand" "b")
15609 (match_operand:SI 2 "register_operand" "r"))))
15610 (unspec [(const_int 0)] 213)])]
15611 "TARGET_ALTIVEC"
15612 "lvxl %0,%1,%2"
15613 [(set_attr "type" "vecload")])
15614
15615 (define_insn "altivec_lvx"
15616 [(set (match_operand:V4SI 0 "register_operand" "=v")
15617 (mem:V4SI (plus:SI (match_operand:SI 1 "register_operand" "b")
15618 (match_operand:SI 2 "register_operand" "r"))))]
15619 "TARGET_ALTIVEC"
15620 "lvx %0,%1,%2"
15621 [(set_attr "type" "vecload")])
15622
15623 (define_insn "altivec_stvx"
15624 [(parallel
15625 [(set (mem:V4SI
15626 (and:SI (plus:SI (match_operand:SI 0 "register_operand" "b")
15627 (match_operand:SI 1 "register_operand" "r"))
15628 (const_int -16)))
15629 (match_operand:V4SI 2 "register_operand" "v"))
15630 (unspec [(const_int 0)] 201)])]
15631 "TARGET_ALTIVEC"
15632 "stvx %2,%0,%1"
15633 [(set_attr "type" "vecstore")])
15634
15635 (define_insn "altivec_stvxl"
15636 [(parallel
15637 [(set (mem:V4SI
15638 (and:SI (plus:SI (match_operand:SI 0 "register_operand" "b")
15639 (match_operand:SI 1 "register_operand" "r"))
15640 (const_int -16)))
15641 (match_operand:V4SI 2 "register_operand" "v"))
15642 (unspec [(const_int 0)] 202)])]
15643 "TARGET_ALTIVEC"
15644 "stvxl %2,%0,%1"
15645 [(set_attr "type" "vecstore")])
15646
15647 (define_insn "altivec_stvebx"
15648 [(parallel
15649 [(set (mem:V16QI
15650 (plus:SI (match_operand:SI 0 "register_operand" "b")
15651 (match_operand:SI 1 "register_operand" "r")))
15652 (match_operand:V16QI 2 "register_operand" "v"))
15653 (unspec [(const_int 0)] 203)])]
15654 "TARGET_ALTIVEC"
15655 "stvebx %2,%0,%1"
15656 [(set_attr "type" "vecstore")])
15657
15658 (define_insn "altivec_stvehx"
15659 [(parallel
15660 [(set (mem:V8HI
15661 (and:SI (plus:SI (match_operand:SI 0 "register_operand" "b")
15662 (match_operand:SI 1 "register_operand" "r"))
15663 (const_int -2)))
15664 (match_operand:V8HI 2 "register_operand" "v"))
15665 (unspec [(const_int 0)] 204)])]
15666 "TARGET_ALTIVEC"
15667 "stvehx %2,%0,%1"
15668 [(set_attr "type" "vecstore")])
15669
15670 (define_insn "altivec_stvewx"
15671 [(parallel
15672 [(set (mem:V4SI
15673 (and:SI (plus:SI (match_operand:SI 0 "register_operand" "b")
15674 (match_operand:SI 1 "register_operand" "r"))
15675 (const_int -4)))
15676 (match_operand:V4SI 2 "register_operand" "v"))
15677 (unspec [(const_int 0)] 205)])]
15678 "TARGET_ALTIVEC"
15679 "stvewx %2,%0,%1"
15680 [(set_attr "type" "vecstore")])
15681
15682 (define_insn "absv16qi2"
15683 [(set (match_operand:V16QI 0 "register_operand" "=v")
15684 (abs:V16QI (match_operand:V16QI 1 "register_operand" "v")))
15685 (clobber (match_scratch:V16QI 2 "=v"))
15686 (clobber (match_scratch:V16QI 3 "=v"))]
15687 "TARGET_ALTIVEC"
15688 "vspltisb %2,0\;vsububm %3,%2,%1\;vmaxsb %0,%1,%3"
15689 [(set_attr "type" "altivec")
15690 (set_attr "length" "12")])
15691
15692 (define_insn "absv8hi2"
15693 [(set (match_operand:V8HI 0 "register_operand" "=v")
15694 (abs:V8HI (match_operand:V8HI 1 "register_operand" "v")))
15695 (clobber (match_scratch:V8HI 2 "=v"))
15696 (clobber (match_scratch:V8HI 3 "=v"))]
15697 "TARGET_ALTIVEC"
15698 "vspltisb %2,0\;vsubuhm %3,%2,%1\;vmaxsh %0,%1,%3"
15699 [(set_attr "type" "altivec")
15700 (set_attr "length" "12")])
15701
15702 (define_insn "absv4si2"
15703 [(set (match_operand:V4SI 0 "register_operand" "=v")
15704 (abs:V4SI (match_operand:V4SI 1 "register_operand" "v")))
15705 (clobber (match_scratch:V4SI 2 "=v"))
15706 (clobber (match_scratch:V4SI 3 "=v"))]
15707 "TARGET_ALTIVEC"
15708 "vspltisb %2,0\;vsubuwm %3,%2,%1\;vmaxsw %0,%1,%3"
15709 [(set_attr "type" "altivec")
15710 (set_attr "length" "12")])
15711
15712 (define_insn "absv4sf2"
15713 [(set (match_operand:V4SF 0 "register_operand" "=v")
15714 (abs:V4SF (match_operand:V4SF 1 "register_operand" "v")))
15715 (clobber (match_scratch:V4SF 2 "=v"))
15716 (clobber (match_scratch:V4SF 3 "=v"))]
15717 "TARGET_ALTIVEC"
15718 "vspltisw %2, -1\;vslw %3,%2,%2\;vandc %0,%1,%3"
15719 [(set_attr "type" "altivec")
15720 (set_attr "length" "12")])
15721
15722 (define_insn "altivec_abss_v16qi"
15723 [(set (match_operand:V16QI 0 "register_operand" "=v")
15724 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")] 210))
15725 (clobber (match_scratch:V16QI 2 "=v"))
15726 (clobber (match_scratch:V16QI 3 "=v"))]
15727 "TARGET_ALTIVEC"
15728 "vspltisb %2,0\;vsubsbs %3,%2,%1\;vmaxsb %0,%1,%3"
15729 [(set_attr "type" "altivec")
15730 (set_attr "length" "12")])
15731
15732 (define_insn "altivec_abss_v8hi"
15733 [(set (match_operand:V8HI 0 "register_operand" "=v")
15734 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")] 211))
15735 (clobber (match_scratch:V8HI 2 "=v"))
15736 (clobber (match_scratch:V8HI 3 "=v"))]
15737 "TARGET_ALTIVEC"
15738 "vspltisb %2,0\;vsubshs %3,%2,%1\;vmaxsh %0,%1,%3"
15739 [(set_attr "type" "altivec")
15740 (set_attr "length" "12")])
15741
15742 (define_insn "altivec_abss_v4si"
15743 [(set (match_operand:V4SI 0 "register_operand" "=v")
15744 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")] 212))
15745 (clobber (match_scratch:V4SI 2 "=v"))
15746 (clobber (match_scratch:V4SI 3 "=v"))]
15747 "TARGET_ALTIVEC"
15748 "vspltisb %2,0\;vsubsws %3,%2,%1\;vmaxsw %0,%1,%3"
15749 [(set_attr "type" "altivec")
15750 (set_attr "length" "12")])