2 ;; Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
3 ;; Contributed by Aldy Hernandez (aldy@quesejoda.com)
5 ;; This file is part of GCC.
7 ;; GCC is free software; you can redistribute it and/or modify it
8 ;; under the terms of the GNU General Public License as published
9 ;; by the Free Software Foundation; either version 2, or (at your
10 ;; option) any later version.
12 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
13 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 ;; License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GCC; see the file COPYING. If not, write to the
19 ;; Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
20 ;; MA 02110-1301, USA.
42 (UNSPEC_VMHRADDSHS 72)
90 (UNSPEC_VRSQRTEFP 157)
103 (UNSPEC_PREDICATE 173)
114 (UNSPEC_SET_VSCR 213)
115 (UNSPEC_GET_VRSAVE 214)
116 (UNSPEC_REALIGN_LOAD 215)
117 (UNSPEC_REDUC_PLUS 217)
119 (UNSPEC_EXTEVEN_V4SI 220)
120 (UNSPEC_EXTEVEN_V8HI 221)
121 (UNSPEC_EXTEVEN_V16QI 222)
122 (UNSPEC_EXTEVEN_V4SF 223)
123 (UNSPEC_EXTODD_V4SI 224)
124 (UNSPEC_EXTODD_V8HI 225)
125 (UNSPEC_EXTODD_V16QI 226)
126 (UNSPEC_EXTODD_V4SF 227)
127 (UNSPEC_INTERHI_V4SI 228)
128 (UNSPEC_INTERHI_V8HI 229)
129 (UNSPEC_INTERHI_V16QI 230)
130 (UNSPEC_INTERHI_V4SF 231)
131 (UNSPEC_INTERLO_V4SI 232)
132 (UNSPEC_INTERLO_V8HI 233)
133 (UNSPEC_INTERLO_V16QI 234)
134 (UNSPEC_INTERLO_V4SF 235)
136 (UNSPEC_VCOND_V4SI 301)
137 (UNSPEC_VCOND_V4SF 302)
138 (UNSPEC_VCOND_V8HI 303)
139 (UNSPEC_VCOND_V16QI 304)
140 (UNSPEC_VCONDU_V4SI 305)
141 (UNSPEC_VCONDU_V8HI 306)
142 (UNSPEC_VCONDU_V16QI 307)
143 (UNSPEC_VMULWHUB 308)
144 (UNSPEC_VMULWLUB 309)
145 (UNSPEC_VMULWHSB 310)
146 (UNSPEC_VMULWLSB 311)
147 (UNSPEC_VMULWHUH 312)
148 (UNSPEC_VMULWLUH 313)
149 (UNSPEC_VMULWHSH 314)
150 (UNSPEC_VMULWLSH 315)
162 [(UNSPECV_SET_VRSAVE 30)
170 (define_mode_macro VI [V4SI V8HI V16QI])
171 ;; Short vec in modes
172 (define_mode_macro VIshort [V8HI V16QI])
174 (define_mode_macro VF [V4SF])
175 ;; Vec modes, pity mode macros are not composable
176 (define_mode_macro V [V4SI V8HI V16QI V4SF])
178 (define_mode_attr VI_char [(V4SI "w") (V8HI "h") (V16QI "b")])
180 ;; Generic LVX load instruction.
181 (define_insn "altivec_lvx_<mode>"
182 [(set (match_operand:V 0 "altivec_register_operand" "=v")
183 (match_operand:V 1 "memory_operand" "Z"))]
186 [(set_attr "type" "vecload")])
188 ;; Generic STVX store instruction.
189 (define_insn "altivec_stvx_<mode>"
190 [(set (match_operand:V 0 "memory_operand" "=Z")
191 (match_operand:V 1 "altivec_register_operand" "v"))]
194 [(set_attr "type" "vecstore")])
196 ;; Vector move instructions.
197 (define_expand "mov<mode>"
198 [(set (match_operand:V 0 "nonimmediate_operand" "")
199 (match_operand:V 1 "any_operand" ""))]
202 rs6000_emit_move (operands[0], operands[1], <MODE>mode);
206 (define_insn "*mov<mode>_internal"
207 [(set (match_operand:V 0 "nonimmediate_operand" "=Z,v,v,o,r,r,v")
208 (match_operand:V 1 "input_operand" "v,Z,v,r,o,r,W"))]
210 && (register_operand (operands[0], <MODE>mode)
211 || register_operand (operands[1], <MODE>mode))"
213 switch (which_alternative)
215 case 0: return "stvx %1,%y0";
216 case 1: return "lvx %0,%y1";
217 case 2: return "vor %0,%1,%1";
221 case 6: return output_vec_const_move (operands);
222 default: gcc_unreachable ();
225 [(set_attr "type" "vecstore,vecload,vecsimple,store,load,*,*")])
228 [(set (match_operand:V4SI 0 "nonimmediate_operand" "")
229 (match_operand:V4SI 1 "input_operand" ""))]
230 "TARGET_ALTIVEC && reload_completed
231 && gpr_or_gpr_p (operands[0], operands[1])"
234 rs6000_split_multireg_move (operands[0], operands[1]); DONE;
238 [(set (match_operand:V8HI 0 "nonimmediate_operand" "")
239 (match_operand:V8HI 1 "input_operand" ""))]
240 "TARGET_ALTIVEC && reload_completed
241 && gpr_or_gpr_p (operands[0], operands[1])"
243 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
246 [(set (match_operand:V16QI 0 "nonimmediate_operand" "")
247 (match_operand:V16QI 1 "input_operand" ""))]
248 "TARGET_ALTIVEC && reload_completed
249 && gpr_or_gpr_p (operands[0], operands[1])"
251 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
254 [(set (match_operand:V4SF 0 "nonimmediate_operand" "")
255 (match_operand:V4SF 1 "input_operand" ""))]
256 "TARGET_ALTIVEC && reload_completed
257 && gpr_or_gpr_p (operands[0], operands[1])"
260 rs6000_split_multireg_move (operands[0], operands[1]); DONE;
264 [(set (match_operand:VI 0 "altivec_register_operand" "")
265 (match_operand:VI 1 "easy_vector_constant_add_self" ""))]
266 "TARGET_ALTIVEC && reload_completed"
267 [(set (match_dup 0) (match_dup 3))
268 (set (match_dup 0) (plus:VI (match_dup 0)
271 rtx dup = gen_easy_altivec_constant (operands[1]);
274 /* Divide the operand of the resulting VEC_DUPLICATE, and use
275 simplify_rtx to make a CONST_VECTOR. */
276 XEXP (dup, 0) = simplify_const_binary_operation (ASHIFTRT, QImode,
277 XEXP (dup, 0), const1_rtx);
278 const_vec = simplify_rtx (dup);
280 if (GET_MODE (const_vec) == <MODE>mode)
281 operands[3] = const_vec;
283 operands[3] = gen_lowpart (<MODE>mode, const_vec);
286 (define_insn "get_vrsave_internal"
287 [(set (match_operand:SI 0 "register_operand" "=r")
288 (unspec:SI [(reg:SI 109)] UNSPEC_GET_VRSAVE))]
292 return "mfspr %0,256";
294 return "mfvrsave %0";
296 [(set_attr "type" "*")])
298 (define_insn "*set_vrsave_internal"
299 [(match_parallel 0 "vrsave_operation"
301 (unspec_volatile:SI [(match_operand:SI 1 "register_operand" "r")
302 (reg:SI 109)] UNSPECV_SET_VRSAVE))])]
306 return "mtspr 256,%1";
308 return "mtvrsave %1";
310 [(set_attr "type" "*")])
312 (define_insn "*save_world"
313 [(match_parallel 0 "save_world_operation"
314 [(clobber (match_operand:SI 1 "register_operand" "=l"))
315 (use (match_operand:SI 2 "call_operand" "s"))])]
316 "TARGET_MACHO && (DEFAULT_ABI == ABI_DARWIN) && TARGET_32BIT"
318 [(set_attr "type" "branch")
319 (set_attr "length" "4")])
321 (define_insn "*restore_world"
322 [(match_parallel 0 "restore_world_operation"
324 (use (match_operand:SI 1 "register_operand" "l"))
325 (use (match_operand:SI 2 "call_operand" "s"))
326 (clobber (match_operand:SI 3 "gpc_reg_operand" "=r"))])]
327 "TARGET_MACHO && (DEFAULT_ABI == ABI_DARWIN) && TARGET_32BIT"
330 ;; Simple binary operations.
333 (define_insn "add<mode>3"
334 [(set (match_operand:VI 0 "register_operand" "=v")
335 (plus:VI (match_operand:VI 1 "register_operand" "v")
336 (match_operand:VI 2 "register_operand" "v")))]
338 "vaddu<VI_char>m %0,%1,%2"
339 [(set_attr "type" "vecsimple")])
341 (define_insn "addv4sf3"
342 [(set (match_operand:V4SF 0 "register_operand" "=v")
343 (plus:V4SF (match_operand:V4SF 1 "register_operand" "v")
344 (match_operand:V4SF 2 "register_operand" "v")))]
347 [(set_attr "type" "vecfloat")])
349 (define_insn "altivec_vaddcuw"
350 [(set (match_operand:V4SI 0 "register_operand" "=v")
351 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
352 (match_operand:V4SI 2 "register_operand" "v")]
356 [(set_attr "type" "vecsimple")])
358 (define_insn "altivec_vaddu<VI_char>s"
359 [(set (match_operand:VI 0 "register_operand" "=v")
360 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
361 (match_operand:VI 2 "register_operand" "v")]
363 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
365 "vaddu<VI_char>s %0,%1,%2"
366 [(set_attr "type" "vecsimple")])
368 (define_insn "altivec_vadds<VI_char>s"
369 [(set (match_operand:VI 0 "register_operand" "=v")
370 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
371 (match_operand:VI 2 "register_operand" "v")]
373 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
375 "vadds<VI_char>s %0,%1,%2"
376 [(set_attr "type" "vecsimple")])
379 (define_insn "sub<mode>3"
380 [(set (match_operand:VI 0 "register_operand" "=v")
381 (minus:VI (match_operand:VI 1 "register_operand" "v")
382 (match_operand:VI 2 "register_operand" "v")))]
384 "vsubu<VI_char>m %0,%1,%2"
385 [(set_attr "type" "vecsimple")])
387 (define_insn "subv4sf3"
388 [(set (match_operand:V4SF 0 "register_operand" "=v")
389 (minus:V4SF (match_operand:V4SF 1 "register_operand" "v")
390 (match_operand:V4SF 2 "register_operand" "v")))]
393 [(set_attr "type" "vecfloat")])
395 (define_insn "altivec_vsubcuw"
396 [(set (match_operand:V4SI 0 "register_operand" "=v")
397 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
398 (match_operand:V4SI 2 "register_operand" "v")]
402 [(set_attr "type" "vecsimple")])
404 (define_insn "altivec_vsubu<VI_char>s"
405 [(set (match_operand:VI 0 "register_operand" "=v")
406 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
407 (match_operand:VI 2 "register_operand" "v")]
409 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
411 "vsubu<VI_char>s %0,%1,%2"
412 [(set_attr "type" "vecsimple")])
414 (define_insn "altivec_vsubs<VI_char>s"
415 [(set (match_operand:VI 0 "register_operand" "=v")
416 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
417 (match_operand:VI 2 "register_operand" "v")]
419 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
421 "vsubs<VI_char>s %0,%1,%2"
422 [(set_attr "type" "vecsimple")])
425 (define_insn "altivec_vavgu<VI_char>"
426 [(set (match_operand:VI 0 "register_operand" "=v")
427 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
428 (match_operand:VI 2 "register_operand" "v")]
431 "vavgu<VI_char> %0,%1,%2"
432 [(set_attr "type" "vecsimple")])
434 (define_insn "altivec_vavgs<VI_char>"
435 [(set (match_operand:VI 0 "register_operand" "=v")
436 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
437 (match_operand:VI 2 "register_operand" "v")]
440 "vavgs<VI_char> %0,%1,%2"
441 [(set_attr "type" "vecsimple")])
443 (define_insn "altivec_vcmpbfp"
444 [(set (match_operand:V4SI 0 "register_operand" "=v")
445 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
446 (match_operand:V4SF 2 "register_operand" "v")]
450 [(set_attr "type" "veccmp")])
452 (define_insn "altivec_vcmpequb"
453 [(set (match_operand:V16QI 0 "register_operand" "=v")
454 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
455 (match_operand:V16QI 2 "register_operand" "v")]
459 [(set_attr "type" "vecsimple")])
461 (define_insn "altivec_vcmpequh"
462 [(set (match_operand:V8HI 0 "register_operand" "=v")
463 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
464 (match_operand:V8HI 2 "register_operand" "v")]
468 [(set_attr "type" "vecsimple")])
470 (define_insn "altivec_vcmpequw"
471 [(set (match_operand:V4SI 0 "register_operand" "=v")
472 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
473 (match_operand:V4SI 2 "register_operand" "v")]
477 [(set_attr "type" "vecsimple")])
479 (define_insn "altivec_vcmpeqfp"
480 [(set (match_operand:V4SI 0 "register_operand" "=v")
481 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
482 (match_operand:V4SF 2 "register_operand" "v")]
486 [(set_attr "type" "veccmp")])
488 (define_insn "altivec_vcmpgefp"
489 [(set (match_operand:V4SI 0 "register_operand" "=v")
490 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
491 (match_operand:V4SF 2 "register_operand" "v")]
495 [(set_attr "type" "veccmp")])
497 (define_insn "altivec_vcmpgtub"
498 [(set (match_operand:V16QI 0 "register_operand" "=v")
499 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
500 (match_operand:V16QI 2 "register_operand" "v")]
504 [(set_attr "type" "vecsimple")])
506 (define_insn "altivec_vcmpgtsb"
507 [(set (match_operand:V16QI 0 "register_operand" "=v")
508 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
509 (match_operand:V16QI 2 "register_operand" "v")]
513 [(set_attr "type" "vecsimple")])
515 (define_insn "altivec_vcmpgtuh"
516 [(set (match_operand:V8HI 0 "register_operand" "=v")
517 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
518 (match_operand:V8HI 2 "register_operand" "v")]
522 [(set_attr "type" "vecsimple")])
524 (define_insn "altivec_vcmpgtsh"
525 [(set (match_operand:V8HI 0 "register_operand" "=v")
526 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
527 (match_operand:V8HI 2 "register_operand" "v")]
531 [(set_attr "type" "vecsimple")])
533 (define_insn "altivec_vcmpgtuw"
534 [(set (match_operand:V4SI 0 "register_operand" "=v")
535 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
536 (match_operand:V4SI 2 "register_operand" "v")]
540 [(set_attr "type" "vecsimple")])
542 (define_insn "altivec_vcmpgtsw"
543 [(set (match_operand:V4SI 0 "register_operand" "=v")
544 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
545 (match_operand:V4SI 2 "register_operand" "v")]
549 [(set_attr "type" "vecsimple")])
551 (define_insn "altivec_vcmpgtfp"
552 [(set (match_operand:V4SI 0 "register_operand" "=v")
553 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
554 (match_operand:V4SF 2 "register_operand" "v")]
558 [(set_attr "type" "veccmp")])
560 ;; Fused multiply add
561 (define_insn "altivec_vmaddfp"
562 [(set (match_operand:V4SF 0 "register_operand" "=v")
563 (plus:V4SF (mult:V4SF (match_operand:V4SF 1 "register_operand" "v")
564 (match_operand:V4SF 2 "register_operand" "v"))
565 (match_operand:V4SF 3 "register_operand" "v")))]
567 "vmaddfp %0,%1,%2,%3"
568 [(set_attr "type" "vecfloat")])
570 ;; We do multiply as a fused multiply-add with an add of a -0.0 vector.
572 (define_expand "mulv4sf3"
573 [(use (match_operand:V4SF 0 "register_operand" ""))
574 (use (match_operand:V4SF 1 "register_operand" ""))
575 (use (match_operand:V4SF 2 "register_operand" ""))]
576 "TARGET_ALTIVEC && TARGET_FUSED_MADD"
581 /* Generate [-0.0, -0.0, -0.0, -0.0]. */
582 neg0 = gen_reg_rtx (V4SFmode);
583 emit_insn (gen_altivec_vspltisw_v4sf (neg0, constm1_rtx));
584 emit_insn (gen_altivec_vslw_v4sf (neg0, neg0, neg0));
586 /* Use the multiply-add. */
587 emit_insn (gen_altivec_vmaddfp (operands[0], operands[1], operands[2],
592 ;; 32 bit integer multiplication
593 ;; A_high = Operand_0 & 0xFFFF0000 >> 16
594 ;; A_low = Operand_0 & 0xFFFF
595 ;; B_high = Operand_1 & 0xFFFF0000 >> 16
596 ;; B_low = Operand_1 & 0xFFFF
597 ;; result = A_low * B_low + (A_high * B_low + B_high * A_low) << 16
599 ;; (define_insn "mulv4si3"
600 ;; [(set (match_operand:V4SI 0 "register_operand" "=v")
601 ;; (mult:V4SI (match_operand:V4SI 1 "register_operand" "v")
602 ;; (match_operand:V4SI 2 "register_operand" "v")))]
603 (define_expand "mulv4si3"
604 [(use (match_operand:V4SI 0 "register_operand" ""))
605 (use (match_operand:V4SI 1 "register_operand" ""))
606 (use (match_operand:V4SI 2 "register_operand" ""))]
619 zero = gen_reg_rtx (V4SImode);
620 emit_insn (gen_altivec_vspltisw (zero, const0_rtx));
622 sixteen = gen_reg_rtx (V4SImode);
623 emit_insn (gen_altivec_vspltisw (sixteen, gen_rtx_CONST_INT (V4SImode, -16)));
625 swap = gen_reg_rtx (V4SImode);
626 emit_insn (gen_altivec_vrlw (swap, operands[2], sixteen));
628 one = gen_reg_rtx (V8HImode);
629 convert_move (one, operands[1], 0);
631 two = gen_reg_rtx (V8HImode);
632 convert_move (two, operands[2], 0);
634 small_swap = gen_reg_rtx (V8HImode);
635 convert_move (small_swap, swap, 0);
637 low_product = gen_reg_rtx (V4SImode);
638 emit_insn (gen_altivec_vmulouh (low_product, one, two));
640 high_product = gen_reg_rtx (V4SImode);
641 emit_insn (gen_altivec_vmsumuhm (high_product, one, small_swap, zero));
643 emit_insn (gen_altivec_vslw (high_product, high_product, sixteen));
645 emit_insn (gen_addv4si3 (operands[0], high_product, low_product));
651 ;; Fused multiply subtract
652 (define_insn "altivec_vnmsubfp"
653 [(set (match_operand:V4SF 0 "register_operand" "=v")
654 (neg:V4SF (minus:V4SF (mult:V4SF (match_operand:V4SF 1 "register_operand" "v")
655 (match_operand:V4SF 2 "register_operand" "v"))
656 (match_operand:V4SF 3 "register_operand" "v"))))]
658 "vnmsubfp %0,%1,%2,%3"
659 [(set_attr "type" "vecfloat")])
661 (define_insn "altivec_vmsumu<VI_char>m"
662 [(set (match_operand:V4SI 0 "register_operand" "=v")
663 (plus:V4SI (match_operand:V4SI 3 "register_operand" "v")
664 (unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v")
665 (match_operand:VIshort 2 "register_operand" "v")]
668 "vmsumu<VI_char>m %0,%1,%2,%3"
669 [(set_attr "type" "veccomplex")])
671 (define_insn "altivec_vmsumm<VI_char>m"
672 [(set (match_operand:V4SI 0 "register_operand" "=v")
673 (plus:V4SI (match_operand:V4SI 3 "register_operand" "v")
674 (unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v")
675 (match_operand:VIshort 2 "register_operand" "v")]
678 "vmsumm<VI_char>m %0,%1,%2,%3"
679 [(set_attr "type" "veccomplex")])
681 (define_insn "altivec_vmsumshm"
682 [(set (match_operand:V4SI 0 "register_operand" "=v")
683 (plus:V4SI (match_operand:V4SI 3 "register_operand" "v")
684 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
685 (match_operand:V8HI 2 "register_operand" "v")]
688 "vmsumshm %0,%1,%2,%3"
689 [(set_attr "type" "veccomplex")])
691 (define_insn "altivec_vmsumuhs"
692 [(set (match_operand:V4SI 0 "register_operand" "=v")
693 (plus:V4SI (match_operand:V4SI 3 "register_operand" "v")
694 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
695 (match_operand:V8HI 2 "register_operand" "v")]
697 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
699 "vmsumuhs %0,%1,%2,%3"
700 [(set_attr "type" "veccomplex")])
702 (define_insn "altivec_vmsumshs"
703 [(set (match_operand:V4SI 0 "register_operand" "=v")
704 (plus:V4SI (match_operand:V4SI 3 "register_operand" "v")
705 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
706 (match_operand:V8HI 2 "register_operand" "v")]
708 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
710 "vmsumshs %0,%1,%2,%3"
711 [(set_attr "type" "veccomplex")])
715 (define_insn "umax<mode>3"
716 [(set (match_operand:VI 0 "register_operand" "=v")
717 (umax:VI (match_operand:VI 1 "register_operand" "v")
718 (match_operand:VI 2 "register_operand" "v")))]
720 "vmaxu<VI_char> %0,%1,%2"
721 [(set_attr "type" "vecsimple")])
723 (define_insn "smax<mode>3"
724 [(set (match_operand:VI 0 "register_operand" "=v")
725 (smax:VI (match_operand:VI 1 "register_operand" "v")
726 (match_operand:VI 2 "register_operand" "v")))]
728 "vmaxs<VI_char> %0,%1,%2"
729 [(set_attr "type" "vecsimple")])
731 (define_insn "smaxv4sf3"
732 [(set (match_operand:V4SF 0 "register_operand" "=v")
733 (smax:V4SF (match_operand:V4SF 1 "register_operand" "v")
734 (match_operand:V4SF 2 "register_operand" "v")))]
737 [(set_attr "type" "veccmp")])
739 (define_insn "umin<mode>3"
740 [(set (match_operand:VI 0 "register_operand" "=v")
741 (umin:VI (match_operand:VI 1 "register_operand" "v")
742 (match_operand:VI 2 "register_operand" "v")))]
744 "vminu<VI_char> %0,%1,%2"
745 [(set_attr "type" "vecsimple")])
747 (define_insn "smin<mode>3"
748 [(set (match_operand:VI 0 "register_operand" "=v")
749 (smin:VI (match_operand:VI 1 "register_operand" "v")
750 (match_operand:VI 2 "register_operand" "v")))]
752 "vmins<VI_char> %0,%1,%2"
753 [(set_attr "type" "vecsimple")])
755 (define_insn "sminv4sf3"
756 [(set (match_operand:V4SF 0 "register_operand" "=v")
757 (smin:V4SF (match_operand:V4SF 1 "register_operand" "v")
758 (match_operand:V4SF 2 "register_operand" "v")))]
761 [(set_attr "type" "veccmp")])
763 (define_insn "altivec_vmhaddshs"
764 [(set (match_operand:V8HI 0 "register_operand" "=v")
765 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
766 (match_operand:V8HI 2 "register_operand" "v")
767 (match_operand:V8HI 3 "register_operand" "v")]
769 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
771 "vmhaddshs %0,%1,%2,%3"
772 [(set_attr "type" "veccomplex")])
774 (define_insn "altivec_vmhraddshs"
775 [(set (match_operand:V8HI 0 "register_operand" "=v")
776 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
777 (match_operand:V8HI 2 "register_operand" "v")
778 (match_operand:V8HI 3 "register_operand" "v")]
780 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
782 "vmhraddshs %0,%1,%2,%3"
783 [(set_attr "type" "veccomplex")])
785 (define_insn "altivec_vmladduhm"
786 [(set (match_operand:V8HI 0 "register_operand" "=v")
787 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
788 (match_operand:V8HI 2 "register_operand" "v")
789 (match_operand:V8HI 3 "register_operand" "v")]
792 "vmladduhm %0,%1,%2,%3"
793 [(set_attr "type" "veccomplex")])
795 (define_insn "altivec_vmrghb"
796 [(set (match_operand:V16QI 0 "register_operand" "=v")
797 (vec_merge:V16QI (vec_select:V16QI (match_operand:V16QI 1 "register_operand" "v")
798 (parallel [(const_int 0)
814 (vec_select:V16QI (match_operand:V16QI 2 "register_operand" "v")
815 (parallel [(const_int 8)
834 [(set_attr "type" "vecperm")])
836 (define_insn "altivec_vmrghh"
837 [(set (match_operand:V8HI 0 "register_operand" "=v")
838 (vec_merge:V8HI (vec_select:V8HI (match_operand:V8HI 1 "register_operand" "v")
839 (parallel [(const_int 0)
847 (vec_select:V8HI (match_operand:V8HI 2 "register_operand" "v")
848 (parallel [(const_int 4)
859 [(set_attr "type" "vecperm")])
861 (define_insn "altivec_vmrghw"
862 [(set (match_operand:V4SI 0 "register_operand" "=v")
863 (vec_merge:V4SI (vec_select:V4SI (match_operand:V4SI 1 "register_operand" "v")
864 (parallel [(const_int 0)
868 (vec_select:V4SI (match_operand:V4SI 2 "register_operand" "v")
869 (parallel [(const_int 2)
876 [(set_attr "type" "vecperm")])
878 (define_insn "altivec_vmrghsf"
879 [(set (match_operand:V4SF 0 "register_operand" "=v")
880 (vec_merge:V4SF (vec_select:V4SF (match_operand:V4SF 1 "register_operand" "v")
881 (parallel [(const_int 0)
885 (vec_select:V4SF (match_operand:V4SF 2 "register_operand" "v")
886 (parallel [(const_int 2)
893 [(set_attr "type" "vecperm")])
895 (define_insn "altivec_vmrglb"
896 [(set (match_operand:V16QI 0 "register_operand" "=v")
897 (vec_merge:V16QI (vec_select:V16QI (match_operand:V16QI 1 "register_operand" "v")
898 (parallel [(const_int 8)
914 (vec_select:V16QI (match_operand:V16QI 2 "register_operand" "v")
915 (parallel [(const_int 0)
934 [(set_attr "type" "vecperm")])
936 (define_insn "altivec_vmrglh"
937 [(set (match_operand:V8HI 0 "register_operand" "=v")
938 (vec_merge:V8HI (vec_select:V8HI (match_operand:V8HI 1 "register_operand" "v")
939 (parallel [(const_int 4)
947 (vec_select:V8HI (match_operand:V8HI 2 "register_operand" "v")
948 (parallel [(const_int 0)
959 [(set_attr "type" "vecperm")])
961 (define_insn "altivec_vmrglw"
962 [(set (match_operand:V4SI 0 "register_operand" "=v")
963 (vec_merge:V4SI (vec_select:V4SI (match_operand:V4SI 1 "register_operand" "v")
964 (parallel [(const_int 2)
968 (vec_select:V4SI (match_operand:V4SI 2 "register_operand" "v")
969 (parallel [(const_int 0)
976 [(set_attr "type" "vecperm")])
978 (define_insn "altivec_vmrglsf"
979 [(set (match_operand:V4SF 0 "register_operand" "=v")
980 (vec_merge:V4SF (vec_select:V4SF (match_operand:V4SF 1 "register_operand" "v")
981 (parallel [(const_int 2)
985 (vec_select:V4SF (match_operand:V4SF 2 "register_operand" "v")
986 (parallel [(const_int 0)
993 [(set_attr "type" "vecperm")])
995 (define_insn "altivec_vmuleub"
996 [(set (match_operand:V8HI 0 "register_operand" "=v")
997 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
998 (match_operand:V16QI 2 "register_operand" "v")]
1002 [(set_attr "type" "veccomplex")])
1004 (define_insn "altivec_vmulesb"
1005 [(set (match_operand:V8HI 0 "register_operand" "=v")
1006 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
1007 (match_operand:V16QI 2 "register_operand" "v")]
1011 [(set_attr "type" "veccomplex")])
1013 (define_insn "altivec_vmuleuh"
1014 [(set (match_operand:V4SI 0 "register_operand" "=v")
1015 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
1016 (match_operand:V8HI 2 "register_operand" "v")]
1020 [(set_attr "type" "veccomplex")])
1022 (define_insn "altivec_vmulesh"
1023 [(set (match_operand:V4SI 0 "register_operand" "=v")
1024 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
1025 (match_operand:V8HI 2 "register_operand" "v")]
1029 [(set_attr "type" "veccomplex")])
1031 (define_insn "altivec_vmuloub"
1032 [(set (match_operand:V8HI 0 "register_operand" "=v")
1033 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
1034 (match_operand:V16QI 2 "register_operand" "v")]
1038 [(set_attr "type" "veccomplex")])
1040 (define_insn "altivec_vmulosb"
1041 [(set (match_operand:V8HI 0 "register_operand" "=v")
1042 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
1043 (match_operand:V16QI 2 "register_operand" "v")]
1047 [(set_attr "type" "veccomplex")])
1049 (define_insn "altivec_vmulouh"
1050 [(set (match_operand:V4SI 0 "register_operand" "=v")
1051 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
1052 (match_operand:V8HI 2 "register_operand" "v")]
1056 [(set_attr "type" "veccomplex")])
1058 (define_insn "altivec_vmulosh"
1059 [(set (match_operand:V4SI 0 "register_operand" "=v")
1060 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
1061 (match_operand:V8HI 2 "register_operand" "v")]
1065 [(set_attr "type" "veccomplex")])
1070 (define_insn "and<mode>3"
1071 [(set (match_operand:VI 0 "register_operand" "=v")
1072 (and:VI (match_operand:VI 1 "register_operand" "v")
1073 (match_operand:VI 2 "register_operand" "v")))]
1076 [(set_attr "type" "vecsimple")])
1078 (define_insn "ior<mode>3"
1079 [(set (match_operand:VI 0 "register_operand" "=v")
1080 (ior:VI (match_operand:VI 1 "register_operand" "v")
1081 (match_operand:VI 2 "register_operand" "v")))]
1084 [(set_attr "type" "vecsimple")])
1086 (define_insn "xor<mode>3"
1087 [(set (match_operand:VI 0 "register_operand" "=v")
1088 (xor:VI (match_operand:VI 1 "register_operand" "v")
1089 (match_operand:VI 2 "register_operand" "v")))]
1092 [(set_attr "type" "vecsimple")])
1094 (define_insn "xorv4sf3"
1095 [(set (match_operand:V4SF 0 "register_operand" "=v")
1096 (xor:V4SF (match_operand:V4SF 1 "register_operand" "v")
1097 (match_operand:V4SF 2 "register_operand" "v")))]
1100 [(set_attr "type" "vecsimple")])
1102 (define_insn "one_cmpl<mode>2"
1103 [(set (match_operand:VI 0 "register_operand" "=v")
1104 (not:VI (match_operand:VI 1 "register_operand" "v")))]
1107 [(set_attr "type" "vecsimple")])
1109 (define_insn "altivec_nor<mode>3"
1110 [(set (match_operand:VI 0 "register_operand" "=v")
1111 (not:VI (ior:VI (match_operand:VI 1 "register_operand" "v")
1112 (match_operand:VI 2 "register_operand" "v"))))]
1115 [(set_attr "type" "vecsimple")])
1117 (define_insn "andc<mode>3"
1118 [(set (match_operand:VI 0 "register_operand" "=v")
1119 (and:VI (not:VI (match_operand:VI 2 "register_operand" "v"))
1120 (match_operand:VI 1 "register_operand" "v")))]
1123 [(set_attr "type" "vecsimple")])
1125 (define_insn "*andc3_v4sf"
1126 [(set (match_operand:V4SF 0 "register_operand" "=v")
1127 (and:V4SF (not:V4SF (match_operand:V4SF 2 "register_operand" "v"))
1128 (match_operand:V4SF 1 "register_operand" "v")))]
1131 [(set_attr "type" "vecsimple")])
1133 (define_insn "altivec_vpkuhum"
1134 [(set (match_operand:V16QI 0 "register_operand" "=v")
1135 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
1136 (match_operand:V8HI 2 "register_operand" "v")]
1140 [(set_attr "type" "vecperm")])
1142 (define_insn "altivec_vpkuwum"
1143 [(set (match_operand:V8HI 0 "register_operand" "=v")
1144 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
1145 (match_operand:V4SI 2 "register_operand" "v")]
1149 [(set_attr "type" "vecperm")])
1151 (define_insn "altivec_vpkpx"
1152 [(set (match_operand:V8HI 0 "register_operand" "=v")
1153 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
1154 (match_operand:V4SI 2 "register_operand" "v")]
1158 [(set_attr "type" "vecperm")])
1160 (define_insn "altivec_vpkshss"
1161 [(set (match_operand:V16QI 0 "register_operand" "=v")
1162 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
1163 (match_operand:V8HI 2 "register_operand" "v")]
1165 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1168 [(set_attr "type" "vecperm")])
1170 (define_insn "altivec_vpkswss"
1171 [(set (match_operand:V8HI 0 "register_operand" "=v")
1172 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
1173 (match_operand:V4SI 2 "register_operand" "v")]
1175 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1178 [(set_attr "type" "vecperm")])
1180 (define_insn "altivec_vpkuhus"
1181 [(set (match_operand:V16QI 0 "register_operand" "=v")
1182 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
1183 (match_operand:V8HI 2 "register_operand" "v")]
1185 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1188 [(set_attr "type" "vecperm")])
1190 (define_insn "altivec_vpkshus"
1191 [(set (match_operand:V16QI 0 "register_operand" "=v")
1192 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
1193 (match_operand:V8HI 2 "register_operand" "v")]
1195 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1198 [(set_attr "type" "vecperm")])
1200 (define_insn "altivec_vpkuwus"
1201 [(set (match_operand:V8HI 0 "register_operand" "=v")
1202 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
1203 (match_operand:V4SI 2 "register_operand" "v")]
1205 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1208 [(set_attr "type" "vecperm")])
1210 (define_insn "altivec_vpkswus"
1211 [(set (match_operand:V8HI 0 "register_operand" "=v")
1212 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
1213 (match_operand:V4SI 2 "register_operand" "v")]
1215 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1218 [(set_attr "type" "vecperm")])
1220 (define_insn "altivec_vrl<VI_char>"
1221 [(set (match_operand:VI 0 "register_operand" "=v")
1222 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
1223 (match_operand:VI 2 "register_operand" "v")]
1226 "vrl<VI_char> %0,%1,%2"
1227 [(set_attr "type" "vecsimple")])
1229 (define_insn "altivec_vsl<VI_char>"
1230 [(set (match_operand:VI 0 "register_operand" "=v")
1231 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
1232 (match_operand:VI 2 "register_operand" "v")]
1235 "vsl<VI_char> %0,%1,%2"
1236 [(set_attr "type" "vecsimple")])
1238 (define_insn "altivec_vslw_v4sf"
1239 [(set (match_operand:V4SF 0 "register_operand" "=v")
1240 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")
1241 (match_operand:V4SF 2 "register_operand" "v")]
1245 [(set_attr "type" "vecsimple")])
1247 (define_insn "altivec_vsl"
1248 [(set (match_operand:V4SI 0 "register_operand" "=v")
1249 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1250 (match_operand:V4SI 2 "register_operand" "v")]
1254 [(set_attr "type" "vecperm")])
1256 (define_insn "altivec_vslo"
1257 [(set (match_operand:V4SI 0 "register_operand" "=v")
1258 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1259 (match_operand:V4SI 2 "register_operand" "v")]
1263 [(set_attr "type" "vecperm")])
1265 (define_insn "lshr<mode>3"
1266 [(set (match_operand:VI 0 "register_operand" "=v")
1267 (lshiftrt:VI (match_operand:VI 1 "register_operand" "v")
1268 (match_operand:VI 2 "register_operand" "v") ))]
1270 "vsr<VI_char> %0,%1,%2"
1271 [(set_attr "type" "vecsimple")])
1273 (define_insn "ashr<mode>3"
1274 [(set (match_operand:VI 0 "register_operand" "=v")
1275 (ashiftrt:VI (match_operand:VI 1 "register_operand" "v")
1276 (match_operand:VI 2 "register_operand" "v") ))]
1278 "vsra<VI_char> %0,%1,%2"
1279 [(set_attr "type" "vecsimple")])
1281 (define_insn "altivec_vsr"
1282 [(set (match_operand:V4SI 0 "register_operand" "=v")
1283 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1284 (match_operand:V4SI 2 "register_operand" "v")]
1288 [(set_attr "type" "vecperm")])
1290 (define_insn "altivec_vsro"
1291 [(set (match_operand:V4SI 0 "register_operand" "=v")
1292 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1293 (match_operand:V4SI 2 "register_operand" "v")]
1297 [(set_attr "type" "vecperm")])
1299 (define_insn "altivec_vsum4ubs"
1300 [(set (match_operand:V4SI 0 "register_operand" "=v")
1301 (unspec:V4SI [(match_operand:V16QI 1 "register_operand" "v")
1302 (match_operand:V4SI 2 "register_operand" "v")]
1304 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1307 [(set_attr "type" "veccomplex")])
1309 (define_insn "altivec_vsum4s<VI_char>s"
1310 [(set (match_operand:V4SI 0 "register_operand" "=v")
1311 (unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v")
1312 (match_operand:V4SI 2 "register_operand" "v")]
1314 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1316 "vsum4s<VI_char>s %0,%1,%2"
1317 [(set_attr "type" "veccomplex")])
1319 (define_insn "altivec_vsum2sws"
1320 [(set (match_operand:V4SI 0 "register_operand" "=v")
1321 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1322 (match_operand:V4SI 2 "register_operand" "v")]
1324 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1327 [(set_attr "type" "veccomplex")])
1329 (define_insn "altivec_vsumsws"
1330 [(set (match_operand:V4SI 0 "register_operand" "=v")
1331 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1332 (match_operand:V4SI 2 "register_operand" "v")]
1334 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1337 [(set_attr "type" "veccomplex")])
1339 (define_insn "altivec_vspltb"
1340 [(set (match_operand:V16QI 0 "register_operand" "=v")
1341 (vec_duplicate:V16QI
1342 (vec_select:QI (match_operand:V16QI 1 "register_operand" "v")
1344 [(match_operand:QI 2 "u5bit_cint_operand" "")]))))]
1347 [(set_attr "type" "vecperm")])
1349 (define_insn "altivec_vsplth"
1350 [(set (match_operand:V8HI 0 "register_operand" "=v")
1352 (vec_select:HI (match_operand:V8HI 1 "register_operand" "v")
1354 [(match_operand:QI 2 "u5bit_cint_operand" "")]))))]
1357 [(set_attr "type" "vecperm")])
1359 (define_insn "altivec_vspltw"
1360 [(set (match_operand:V4SI 0 "register_operand" "=v")
1362 (vec_select:SI (match_operand:V4SI 1 "register_operand" "v")
1364 [(match_operand:QI 2 "u5bit_cint_operand" "i")]))))]
1367 [(set_attr "type" "vecperm")])
1369 (define_insn "*altivec_vspltsf"
1370 [(set (match_operand:V4SF 0 "register_operand" "=v")
1372 (vec_select:SF (match_operand:V4SF 1 "register_operand" "v")
1374 [(match_operand:QI 2 "u5bit_cint_operand" "i")]))))]
1377 [(set_attr "type" "vecperm")])
1379 (define_insn "altivec_vspltis<VI_char>"
1380 [(set (match_operand:VI 0 "register_operand" "=v")
1382 (match_operand:QI 1 "s5bit_cint_operand" "i")))]
1384 "vspltis<VI_char> %0,%1"
1385 [(set_attr "type" "vecperm")])
1387 (define_insn "altivec_vspltisw_v4sf"
1388 [(set (match_operand:V4SF 0 "register_operand" "=v")
1390 (float:SF (match_operand:QI 1 "s5bit_cint_operand" "i"))))]
1393 [(set_attr "type" "vecperm")])
1395 (define_insn "ftruncv4sf2"
1396 [(set (match_operand:V4SF 0 "register_operand" "=v")
1397 (fix:V4SF (match_operand:V4SF 1 "register_operand" "v")))]
1400 [(set_attr "type" "vecfloat")])
1402 (define_insn "altivec_vperm_<mode>"
1403 [(set (match_operand:V 0 "register_operand" "=v")
1404 (unspec:V [(match_operand:V 1 "register_operand" "v")
1405 (match_operand:V 2 "register_operand" "v")
1406 (match_operand:V16QI 3 "register_operand" "v")]
1410 [(set_attr "type" "vecperm")])
1412 (define_insn "altivec_vrfip"
1413 [(set (match_operand:V4SF 0 "register_operand" "=v")
1414 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1418 [(set_attr "type" "vecfloat")])
1420 (define_insn "altivec_vrfin"
1421 [(set (match_operand:V4SF 0 "register_operand" "=v")
1422 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1426 [(set_attr "type" "vecfloat")])
1428 (define_insn "altivec_vrfim"
1429 [(set (match_operand:V4SF 0 "register_operand" "=v")
1430 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1434 [(set_attr "type" "vecfloat")])
1436 (define_insn "altivec_vcfux"
1437 [(set (match_operand:V4SF 0 "register_operand" "=v")
1438 (unspec:V4SF [(match_operand:V4SI 1 "register_operand" "v")
1439 (match_operand:QI 2 "immediate_operand" "i")]
1443 [(set_attr "type" "vecfloat")])
1445 (define_insn "altivec_vcfsx"
1446 [(set (match_operand:V4SF 0 "register_operand" "=v")
1447 (unspec:V4SF [(match_operand:V4SI 1 "register_operand" "v")
1448 (match_operand:QI 2 "immediate_operand" "i")]
1452 [(set_attr "type" "vecfloat")])
1454 (define_insn "altivec_vctuxs"
1455 [(set (match_operand:V4SI 0 "register_operand" "=v")
1456 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
1457 (match_operand:QI 2 "immediate_operand" "i")]
1459 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1462 [(set_attr "type" "vecfloat")])
1464 (define_insn "altivec_vctsxs"
1465 [(set (match_operand:V4SI 0 "register_operand" "=v")
1466 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
1467 (match_operand:QI 2 "immediate_operand" "i")]
1469 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1472 [(set_attr "type" "vecfloat")])
1474 (define_insn "altivec_vlogefp"
1475 [(set (match_operand:V4SF 0 "register_operand" "=v")
1476 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1480 [(set_attr "type" "vecfloat")])
1482 (define_insn "altivec_vexptefp"
1483 [(set (match_operand:V4SF 0 "register_operand" "=v")
1484 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1488 [(set_attr "type" "vecfloat")])
1490 (define_insn "altivec_vrsqrtefp"
1491 [(set (match_operand:V4SF 0 "register_operand" "=v")
1492 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1496 [(set_attr "type" "vecfloat")])
1498 (define_insn "altivec_vrefp"
1499 [(set (match_operand:V4SF 0 "register_operand" "=v")
1500 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1504 [(set_attr "type" "vecfloat")])
1506 (define_expand "vcondv4si"
1507 [(set (match_operand:V4SI 0 "register_operand" "=v")
1508 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1509 (match_operand:V4SI 2 "register_operand" "v")
1510 (match_operand:V4SI 3 "comparison_operator" "")
1511 (match_operand:V4SI 4 "register_operand" "v")
1512 (match_operand:V4SI 5 "register_operand" "v")
1513 ] UNSPEC_VCOND_V4SI))]
1517 if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
1518 operands[3], operands[4], operands[5]))
1525 (define_expand "vconduv4si"
1526 [(set (match_operand:V4SI 0 "register_operand" "=v")
1527 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1528 (match_operand:V4SI 2 "register_operand" "v")
1529 (match_operand:V4SI 3 "comparison_operator" "")
1530 (match_operand:V4SI 4 "register_operand" "v")
1531 (match_operand:V4SI 5 "register_operand" "v")
1532 ] UNSPEC_VCONDU_V4SI))]
1536 if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
1537 operands[3], operands[4], operands[5]))
1544 (define_expand "vcondv4sf"
1545 [(set (match_operand:V4SF 0 "register_operand" "=v")
1546 (unspec:V4SF [(match_operand:V4SI 1 "register_operand" "v")
1547 (match_operand:V4SF 2 "register_operand" "v")
1548 (match_operand:V4SF 3 "comparison_operator" "")
1549 (match_operand:V4SF 4 "register_operand" "v")
1550 (match_operand:V4SF 5 "register_operand" "v")
1551 ] UNSPEC_VCOND_V4SF))]
1555 if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
1556 operands[3], operands[4], operands[5]))
1563 (define_expand "vcondv8hi"
1564 [(set (match_operand:V4SF 0 "register_operand" "=v")
1565 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
1566 (match_operand:V8HI 2 "register_operand" "v")
1567 (match_operand:V8HI 3 "comparison_operator" "")
1568 (match_operand:V8HI 4 "register_operand" "v")
1569 (match_operand:V8HI 5 "register_operand" "v")
1570 ] UNSPEC_VCOND_V8HI))]
1574 if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
1575 operands[3], operands[4], operands[5]))
1582 (define_expand "vconduv8hi"
1583 [(set (match_operand:V4SF 0 "register_operand" "=v")
1584 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
1585 (match_operand:V8HI 2 "register_operand" "v")
1586 (match_operand:V8HI 3 "comparison_operator" "")
1587 (match_operand:V8HI 4 "register_operand" "v")
1588 (match_operand:V8HI 5 "register_operand" "v")
1589 ] UNSPEC_VCONDU_V8HI))]
1593 if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
1594 operands[3], operands[4], operands[5]))
1601 (define_expand "vcondv16qi"
1602 [(set (match_operand:V4SF 0 "register_operand" "=v")
1603 (unspec:V16QI [(match_operand:V4SI 1 "register_operand" "v")
1604 (match_operand:V16QI 2 "register_operand" "v")
1605 (match_operand:V16QI 3 "comparison_operator" "")
1606 (match_operand:V16QI 4 "register_operand" "v")
1607 (match_operand:V16QI 5 "register_operand" "v")
1608 ] UNSPEC_VCOND_V16QI))]
1612 if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
1613 operands[3], operands[4], operands[5]))
1620 (define_expand "vconduv16qi"
1621 [(set (match_operand:V4SF 0 "register_operand" "=v")
1622 (unspec:V16QI [(match_operand:V4SI 1 "register_operand" "v")
1623 (match_operand:V16QI 2 "register_operand" "v")
1624 (match_operand:V16QI 3 "comparison_operator" "")
1625 (match_operand:V16QI 4 "register_operand" "v")
1626 (match_operand:V16QI 5 "register_operand" "v")
1627 ] UNSPEC_VCONDU_V16QI))]
1631 if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
1632 operands[3], operands[4], operands[5]))
1640 (define_insn "altivec_vsel_v4si"
1641 [(set (match_operand:V4SI 0 "register_operand" "=v")
1642 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1643 (match_operand:V4SI 2 "register_operand" "v")
1644 (match_operand:V4SI 3 "register_operand" "v")]
1648 [(set_attr "type" "vecperm")])
1650 (define_insn "altivec_vsel_v4sf"
1651 [(set (match_operand:V4SF 0 "register_operand" "=v")
1652 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")
1653 (match_operand:V4SF 2 "register_operand" "v")
1654 (match_operand:V4SI 3 "register_operand" "v")]
1658 [(set_attr "type" "vecperm")])
1660 (define_insn "altivec_vsel_v8hi"
1661 [(set (match_operand:V8HI 0 "register_operand" "=v")
1662 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
1663 (match_operand:V8HI 2 "register_operand" "v")
1664 (match_operand:V8HI 3 "register_operand" "v")]
1668 [(set_attr "type" "vecperm")])
1670 (define_insn "altivec_vsel_v16qi"
1671 [(set (match_operand:V16QI 0 "register_operand" "=v")
1672 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
1673 (match_operand:V16QI 2 "register_operand" "v")
1674 (match_operand:V16QI 3 "register_operand" "v")]
1678 [(set_attr "type" "vecperm")])
1680 (define_insn "altivec_vsldoi_<mode>"
1681 [(set (match_operand:V 0 "register_operand" "=v")
1682 (unspec:V [(match_operand:V 1 "register_operand" "v")
1683 (match_operand:V 2 "register_operand" "v")
1684 (match_operand:QI 3 "immediate_operand" "i")]
1687 "vsldoi %0,%1,%2,%3"
1688 [(set_attr "type" "vecperm")])
1690 (define_insn "altivec_vupkhsb"
1691 [(set (match_operand:V8HI 0 "register_operand" "=v")
1692 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
1696 [(set_attr "type" "vecperm")])
1698 (define_insn "altivec_vupkhpx"
1699 [(set (match_operand:V4SI 0 "register_operand" "=v")
1700 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
1704 [(set_attr "type" "vecperm")])
1706 (define_insn "altivec_vupkhsh"
1707 [(set (match_operand:V4SI 0 "register_operand" "=v")
1708 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
1712 [(set_attr "type" "vecperm")])
1714 (define_insn "altivec_vupklsb"
1715 [(set (match_operand:V8HI 0 "register_operand" "=v")
1716 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
1720 [(set_attr "type" "vecperm")])
1722 (define_insn "altivec_vupklpx"
1723 [(set (match_operand:V4SI 0 "register_operand" "=v")
1724 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
1728 [(set_attr "type" "vecperm")])
1730 (define_insn "altivec_vupklsh"
1731 [(set (match_operand:V4SI 0 "register_operand" "=v")
1732 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
1736 [(set_attr "type" "vecperm")])
1738 ;; AltiVec predicates.
1740 (define_expand "cr6_test_for_zero"
1741 [(set (match_operand:SI 0 "register_operand" "=r")
1747 (define_expand "cr6_test_for_zero_reverse"
1748 [(set (match_operand:SI 0 "register_operand" "=r")
1751 (set (match_dup 0) (minus:SI (const_int 1) (match_dup 0)))]
1755 (define_expand "cr6_test_for_lt"
1756 [(set (match_operand:SI 0 "register_operand" "=r")
1762 (define_expand "cr6_test_for_lt_reverse"
1763 [(set (match_operand:SI 0 "register_operand" "=r")
1766 (set (match_dup 0) (minus:SI (const_int 1) (match_dup 0)))]
1770 ;; We can get away with generating the opcode on the fly (%3 below)
1771 ;; because all the predicates have the same scheduling parameters.
1773 (define_insn "altivec_predicate_<mode>"
1775 (unspec:CC [(match_operand:V 1 "register_operand" "v")
1776 (match_operand:V 2 "register_operand" "v")
1777 (match_operand 3 "any_operand" "")] UNSPEC_PREDICATE))
1778 (clobber (match_scratch:V 0 "=v"))]
1781 [(set_attr "type" "veccmp")])
1783 (define_insn "altivec_mtvscr"
1786 [(match_operand:V4SI 0 "register_operand" "v")] UNSPECV_MTVSCR))]
1789 [(set_attr "type" "vecsimple")])
1791 (define_insn "altivec_mfvscr"
1792 [(set (match_operand:V8HI 0 "register_operand" "=v")
1793 (unspec_volatile:V8HI [(reg:SI 110)] UNSPECV_MFVSCR))]
1796 [(set_attr "type" "vecsimple")])
1798 (define_insn "altivec_dssall"
1799 [(unspec_volatile [(const_int 0)] UNSPECV_DSSALL)]
1802 [(set_attr "type" "vecsimple")])
1804 (define_insn "altivec_dss"
1805 [(unspec_volatile [(match_operand:QI 0 "immediate_operand" "i")]
1809 [(set_attr "type" "vecsimple")])
1811 (define_insn "altivec_dst"
1812 [(unspec [(match_operand 0 "register_operand" "b")
1813 (match_operand:SI 1 "register_operand" "r")
1814 (match_operand:QI 2 "immediate_operand" "i")] UNSPEC_DST)]
1815 "TARGET_ALTIVEC && GET_MODE (operands[0]) == Pmode"
1817 [(set_attr "type" "vecsimple")])
1819 (define_insn "altivec_dstt"
1820 [(unspec [(match_operand 0 "register_operand" "b")
1821 (match_operand:SI 1 "register_operand" "r")
1822 (match_operand:QI 2 "immediate_operand" "i")] UNSPEC_DSTT)]
1823 "TARGET_ALTIVEC && GET_MODE (operands[0]) == Pmode"
1825 [(set_attr "type" "vecsimple")])
1827 (define_insn "altivec_dstst"
1828 [(unspec [(match_operand 0 "register_operand" "b")
1829 (match_operand:SI 1 "register_operand" "r")
1830 (match_operand:QI 2 "immediate_operand" "i")] UNSPEC_DSTST)]
1831 "TARGET_ALTIVEC && GET_MODE (operands[0]) == Pmode"
1833 [(set_attr "type" "vecsimple")])
1835 (define_insn "altivec_dststt"
1836 [(unspec [(match_operand 0 "register_operand" "b")
1837 (match_operand:SI 1 "register_operand" "r")
1838 (match_operand:QI 2 "immediate_operand" "i")] UNSPEC_DSTSTT)]
1839 "TARGET_ALTIVEC && GET_MODE (operands[0]) == Pmode"
1841 [(set_attr "type" "vecsimple")])
1843 (define_insn "altivec_lvsl"
1844 [(set (match_operand:V16QI 0 "register_operand" "=v")
1845 (unspec:V16QI [(match_operand 1 "memory_operand" "Z")] UNSPEC_LVSL))]
1848 [(set_attr "type" "vecload")])
1850 (define_insn "altivec_lvsr"
1851 [(set (match_operand:V16QI 0 "register_operand" "=v")
1852 (unspec:V16QI [(match_operand 1 "memory_operand" "Z")] UNSPEC_LVSR))]
1855 [(set_attr "type" "vecload")])
1857 (define_expand "build_vector_mask_for_load"
1858 [(set (match_operand:V16QI 0 "register_operand" "")
1859 (unspec:V16QI [(match_operand 1 "memory_operand" "")] UNSPEC_LVSR))]
1866 gcc_assert (GET_CODE (operands[1]) == MEM);
1868 addr = XEXP (operands[1], 0);
1869 temp = gen_reg_rtx (GET_MODE (addr));
1870 emit_insn (gen_rtx_SET (VOIDmode, temp,
1871 gen_rtx_NEG (GET_MODE (addr), addr)));
1872 emit_insn (gen_altivec_lvsr (operands[0],
1873 replace_equiv_address (operands[1], temp)));
1877 ;; Parallel some of the LVE* and STV*'s with unspecs because some have
1878 ;; identical rtl but different instructions-- and gcc gets confused.
1880 (define_insn "altivec_lve<VI_char>x"
1882 [(set (match_operand:VI 0 "register_operand" "=v")
1883 (match_operand:VI 1 "memory_operand" "Z"))
1884 (unspec [(const_int 0)] UNSPEC_LVE)])]
1886 "lve<VI_char>x %0,%y1"
1887 [(set_attr "type" "vecload")])
1889 (define_insn "*altivec_lvesfx"
1891 [(set (match_operand:V4SF 0 "register_operand" "=v")
1892 (match_operand:V4SF 1 "memory_operand" "Z"))
1893 (unspec [(const_int 0)] UNSPEC_LVE)])]
1896 [(set_attr "type" "vecload")])
1898 (define_insn "altivec_lvxl"
1900 [(set (match_operand:V4SI 0 "register_operand" "=v")
1901 (match_operand:V4SI 1 "memory_operand" "Z"))
1902 (unspec [(const_int 0)] UNSPEC_SET_VSCR)])]
1905 [(set_attr "type" "vecload")])
1907 (define_insn "altivec_lvx"
1908 [(set (match_operand:V4SI 0 "register_operand" "=v")
1909 (match_operand:V4SI 1 "memory_operand" "Z"))]
1912 [(set_attr "type" "vecload")])
1914 (define_insn "altivec_stvx"
1916 [(set (match_operand:V4SI 0 "memory_operand" "=Z")
1917 (match_operand:V4SI 1 "register_operand" "v"))
1918 (unspec [(const_int 0)] UNSPEC_STVX)])]
1921 [(set_attr "type" "vecstore")])
1923 (define_insn "altivec_stvxl"
1925 [(set (match_operand:V4SI 0 "memory_operand" "=Z")
1926 (match_operand:V4SI 1 "register_operand" "v"))
1927 (unspec [(const_int 0)] UNSPEC_STVXL)])]
1930 [(set_attr "type" "vecstore")])
1932 (define_insn "altivec_stve<VI_char>x"
1934 [(set (match_operand:VI 0 "memory_operand" "=Z")
1935 (match_operand:VI 1 "register_operand" "v"))
1936 (unspec [(const_int 0)] UNSPEC_STVE)])]
1938 "stve<VI_char>x %1,%y0"
1939 [(set_attr "type" "vecstore")])
1941 (define_insn "*altivec_stvesfx"
1943 [(set (match_operand:V4SF 0 "memory_operand" "=Z")
1944 (match_operand:V4SF 1 "register_operand" "v"))
1945 (unspec [(const_int 0)] UNSPEC_STVE)])]
1948 [(set_attr "type" "vecstore")])
1950 (define_expand "vec_init<mode>"
1951 [(match_operand:V 0 "register_operand" "")
1952 (match_operand 1 "" "")]
1955 rs6000_expand_vector_init (operands[0], operands[1]);
1959 (define_expand "vec_setv4si"
1960 [(match_operand:V4SI 0 "register_operand" "")
1961 (match_operand:SI 1 "register_operand" "")
1962 (match_operand 2 "const_int_operand" "")]
1965 rs6000_expand_vector_set (operands[0], operands[1], INTVAL (operands[2]));
1969 (define_expand "vec_setv8hi"
1970 [(match_operand:V8HI 0 "register_operand" "")
1971 (match_operand:HI 1 "register_operand" "")
1972 (match_operand 2 "const_int_operand" "")]
1975 rs6000_expand_vector_set (operands[0], operands[1], INTVAL (operands[2]));
1979 (define_expand "vec_setv16qi"
1980 [(match_operand:V16QI 0 "register_operand" "")
1981 (match_operand:QI 1 "register_operand" "")
1982 (match_operand 2 "const_int_operand" "")]
1985 rs6000_expand_vector_set (operands[0], operands[1], INTVAL (operands[2]));
1989 (define_expand "vec_setv4sf"
1990 [(match_operand:V4SF 0 "register_operand" "")
1991 (match_operand:SF 1 "register_operand" "")
1992 (match_operand 2 "const_int_operand" "")]
1995 rs6000_expand_vector_set (operands[0], operands[1], INTVAL (operands[2]));
1999 (define_expand "vec_extractv4si"
2000 [(match_operand:SI 0 "register_operand" "")
2001 (match_operand:V4SI 1 "register_operand" "")
2002 (match_operand 2 "const_int_operand" "")]
2005 rs6000_expand_vector_extract (operands[0], operands[1], INTVAL (operands[2]));
2009 (define_expand "vec_extractv8hi"
2010 [(match_operand:HI 0 "register_operand" "")
2011 (match_operand:V8HI 1 "register_operand" "")
2012 (match_operand 2 "const_int_operand" "")]
2015 rs6000_expand_vector_extract (operands[0], operands[1], INTVAL (operands[2]));
2019 (define_expand "vec_extractv16qi"
2020 [(match_operand:QI 0 "register_operand" "")
2021 (match_operand:V16QI 1 "register_operand" "")
2022 (match_operand 2 "const_int_operand" "")]
2025 rs6000_expand_vector_extract (operands[0], operands[1], INTVAL (operands[2]));
2029 (define_expand "vec_extractv4sf"
2030 [(match_operand:SF 0 "register_operand" "")
2031 (match_operand:V4SF 1 "register_operand" "")
2032 (match_operand 2 "const_int_operand" "")]
2035 rs6000_expand_vector_extract (operands[0], operands[1], INTVAL (operands[2]));
2040 ;; vspltis? SCRATCH0,0
2041 ;; vsubu?m SCRATCH2,SCRATCH1,%1
2042 ;; vmaxs? %0,%1,SCRATCH2"
2043 (define_expand "abs<mode>2"
2044 [(set (match_dup 2) (vec_duplicate:VI (const_int 0)))
2046 (minus:VI (match_dup 2)
2047 (match_operand:VI 1 "register_operand" "v")))
2048 (set (match_operand:VI 0 "register_operand" "=v")
2049 (smax:VI (match_dup 1) (match_dup 3)))]
2052 operands[2] = gen_reg_rtx (GET_MODE (operands[0]));
2053 operands[3] = gen_reg_rtx (GET_MODE (operands[0]));
2057 ;; vspltisw SCRATCH1,-1
2058 ;; vslw SCRATCH2,SCRATCH1,SCRATCH1
2059 ;; vandc %0,%1,SCRATCH2
2060 (define_expand "absv4sf2"
2062 (vec_duplicate:V4SF (float:SF (const_int -1))))
2064 (unspec:V4SF [(match_dup 2) (match_dup 2)] UNSPEC_VSLW))
2065 (set (match_operand:V4SF 0 "register_operand" "=v")
2066 (and:V4SF (not:V4SF (match_dup 3))
2067 (match_operand:V4SF 1 "register_operand" "v")))]
2070 operands[2] = gen_reg_rtx (V4SFmode);
2071 operands[3] = gen_reg_rtx (V4SFmode);
2075 ;; vspltis? SCRATCH0,0
2076 ;; vsubs?s SCRATCH2,SCRATCH1,%1
2077 ;; vmaxs? %0,%1,SCRATCH2"
2078 (define_expand "altivec_abss_<mode>"
2079 [(set (match_dup 2) (vec_duplicate:VI (const_int 0)))
2080 (parallel [(set (match_dup 3)
2081 (unspec:VI [(match_dup 2)
2082 (match_operand:VI 1 "register_operand" "v")]
2084 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))])
2085 (set (match_operand:VI 0 "register_operand" "=v")
2086 (smax:VI (match_dup 1) (match_dup 3)))]
2089 operands[2] = gen_reg_rtx (GET_MODE (operands[0]));
2090 operands[3] = gen_reg_rtx (GET_MODE (operands[0]));
2093 ;; Vector shift left in bits. Currently supported only for shift
2094 ;; amounts that can be expressed as byte shifts (divisible by 8).
2095 ;; General shift amounts can be supported using vslo + vsl. We're
2096 ;; not expecting to see these yet (the vectorizer currently
2097 ;; generates only shifts divisible by byte_size).
2098 (define_expand "vec_shl_<mode>"
2099 [(set (match_operand:V 0 "register_operand" "=v")
2100 (unspec:V [(match_operand:V 1 "register_operand" "v")
2101 (match_operand:QI 2 "reg_or_short_operand" "")]
2106 rtx bitshift = operands[2];
2107 rtx byteshift = gen_reg_rtx (QImode);
2108 HOST_WIDE_INT bitshift_val;
2109 HOST_WIDE_INT byteshift_val;
2111 if (! CONSTANT_P (bitshift))
2113 bitshift_val = INTVAL (bitshift);
2114 if (bitshift_val & 0x7)
2116 byteshift_val = bitshift_val >> 3;
2117 byteshift = gen_rtx_CONST_INT (QImode, byteshift_val);
2118 emit_insn (gen_altivec_vsldoi_<mode> (operands[0], operands[1], operands[1],
2123 ;; Vector shift right in bits. Currently supported only for shift
2124 ;; amounts that can be expressed as byte shifts (divisible by 8).
2125 ;; General shift amounts can be supported using vsro + vsr. We're
2126 ;; not expecting to see these yet (the vectorizer currently
2127 ;; generates only shifts divisible by byte_size).
2128 (define_expand "vec_shr_<mode>"
2129 [(set (match_operand:V 0 "register_operand" "=v")
2130 (unspec:V [(match_operand:V 1 "register_operand" "v")
2131 (match_operand:QI 2 "reg_or_short_operand" "")]
2136 rtx bitshift = operands[2];
2137 rtx byteshift = gen_reg_rtx (QImode);
2138 HOST_WIDE_INT bitshift_val;
2139 HOST_WIDE_INT byteshift_val;
2141 if (! CONSTANT_P (bitshift))
2143 bitshift_val = INTVAL (bitshift);
2144 if (bitshift_val & 0x7)
2146 byteshift_val = 16 - (bitshift_val >> 3);
2147 byteshift = gen_rtx_CONST_INT (QImode, byteshift_val);
2148 emit_insn (gen_altivec_vsldoi_<mode> (operands[0], operands[1], operands[1],
2153 (define_insn "altivec_vsumsws_nomode"
2154 [(set (match_operand 0 "register_operand" "=v")
2155 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
2156 (match_operand:V4SI 2 "register_operand" "v")]
2158 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
2161 [(set_attr "type" "veccomplex")])
2163 (define_expand "reduc_splus_<mode>"
2164 [(set (match_operand:VIshort 0 "register_operand" "=v")
2165 (unspec:VIshort [(match_operand:VIshort 1 "register_operand" "v")]
2166 UNSPEC_REDUC_PLUS))]
2170 rtx vzero = gen_reg_rtx (V4SImode);
2171 rtx vtmp1 = gen_reg_rtx (V4SImode);
2173 emit_insn (gen_altivec_vspltisw (vzero, const0_rtx));
2174 emit_insn (gen_altivec_vsum4s<VI_char>s (vtmp1, operands[1], vzero));
2175 emit_insn (gen_altivec_vsumsws_nomode (operands[0], vtmp1, vzero));
2179 (define_expand "reduc_uplus_v16qi"
2180 [(set (match_operand:V16QI 0 "register_operand" "=v")
2181 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")]
2182 UNSPEC_REDUC_PLUS))]
2186 rtx vzero = gen_reg_rtx (V4SImode);
2187 rtx vtmp1 = gen_reg_rtx (V4SImode);
2189 emit_insn (gen_altivec_vspltisw (vzero, const0_rtx));
2190 emit_insn (gen_altivec_vsum4ubs (vtmp1, operands[1], vzero));
2191 emit_insn (gen_altivec_vsumsws_nomode (operands[0], vtmp1, vzero));
2195 (define_insn "vec_realign_load_<mode>"
2196 [(set (match_operand:V 0 "register_operand" "=v")
2197 (unspec:V [(match_operand:V 1 "register_operand" "v")
2198 (match_operand:V 2 "register_operand" "v")
2199 (match_operand:V16QI 3 "register_operand" "v")]
2200 UNSPEC_REALIGN_LOAD))]
2203 [(set_attr "type" "vecperm")])
2205 (define_expand "usat_subv16qi3"
2206 [(set (match_operand:V16QI 0 "register_operand" "=v")
2207 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
2208 (match_operand:V16QI 2 "register_operand" "v")] 125))
2209 (set (reg:SI 110) (unspec:SI [(const_int 0)] 213))]
2213 emit_insn (gen_altivec_vsububs (operands[0], operands[1], operands[2]));
2217 (define_expand "usat_subv8hi3"
2218 [(set (match_operand:V8HI 0 "register_operand" "=v")
2219 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
2220 (match_operand:V8HI 2 "register_operand" "v")] 127))
2221 (set (reg:SI 110) (unspec:SI [(const_int 0)] 213))]
2225 emit_insn (gen_altivec_vsubuhs (operands[0], operands[1], operands[2]));
2229 (define_expand "usat_subv4si3"
2230 [(set (match_operand:V4SI 0 "register_operand" "=v")
2231 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
2232 (match_operand:V4SI 2 "register_operand" "v")] 129))
2233 (set (reg:SI 110) (unspec:SI [(const_int 0)] 213))]
2237 emit_insn (gen_altivec_vsubuws (operands[0], operands[1], operands[2]));
2241 (define_expand "udot_prod<mode>"
2242 [(set (match_operand:V4SI 0 "register_operand" "=v")
2243 (plus:V4SI (match_operand:V4SI 3 "register_operand" "v")
2244 (unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v")
2245 (match_operand:VIshort 2 "register_operand" "v")]
2250 emit_insn (gen_altivec_vmsumu<VI_char>m (operands[0], operands[1], operands[2], operands[3]));
2254 (define_expand "sdot_prodv8hi"
2255 [(set (match_operand:V4SI 0 "register_operand" "=v")
2256 (plus:V4SI (match_operand:V4SI 3 "register_operand" "v")
2257 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
2258 (match_operand:V8HI 2 "register_operand" "v")]
2263 emit_insn (gen_altivec_vmsumshm (operands[0], operands[1], operands[2], operands[3]));
2267 (define_expand "neg<mode>2"
2268 [(use (match_operand:VI 0 "register_operand" ""))
2269 (use (match_operand:VI 1 "register_operand" ""))]
2275 vzero = gen_reg_rtx (GET_MODE (operands[0]));
2276 emit_insn (gen_altivec_vspltis<VI_char> (vzero, const0_rtx));
2277 emit_insn (gen_sub<mode>3 (operands[0], vzero, operands[1]));
2282 (define_expand "negv4sf2"
2283 [(use (match_operand:V4SF 0 "register_operand" ""))
2284 (use (match_operand:V4SF 1 "register_operand" ""))]
2290 /* Generate [-0.0, -0.0, -0.0, -0.0]. */
2291 neg0 = gen_reg_rtx (V4SFmode);
2292 emit_insn (gen_altivec_vspltisw_v4sf (neg0, constm1_rtx));
2293 emit_insn (gen_altivec_vslw_v4sf (neg0, neg0, neg0));
2296 emit_insn (gen_xorv4sf3 (operands[0], neg0, operands[1]));
2301 (define_expand "widen_usum<mode>3"
2302 [(set (match_operand:V4SI 0 "register_operand" "=v")
2303 (plus:V4SI (match_operand:V4SI 2 "register_operand" "v")
2304 (unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v")]
2309 rtx vones = gen_reg_rtx (GET_MODE (operands[1]));
2311 emit_insn (gen_altivec_vspltis<VI_char> (vones, const1_rtx));
2312 emit_insn (gen_altivec_vmsumu<VI_char>m (operands[0], operands[1], vones, operands[2]));
2316 (define_expand "widen_ssumv16qi3"
2317 [(set (match_operand:V4SI 0 "register_operand" "=v")
2318 (plus:V4SI (match_operand:V4SI 2 "register_operand" "v")
2319 (unspec:V4SI [(match_operand:V16QI 1 "register_operand" "v")]
2324 rtx vones = gen_reg_rtx (V16QImode);
2326 emit_insn (gen_altivec_vspltisb (vones, const1_rtx));
2327 emit_insn (gen_altivec_vmsummbm (operands[0], operands[1], vones, operands[2]));
2331 (define_expand "widen_ssumv8hi3"
2332 [(set (match_operand:V4SI 0 "register_operand" "=v")
2333 (plus:V4SI (match_operand:V4SI 2 "register_operand" "v")
2334 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
2339 rtx vones = gen_reg_rtx (V8HImode);
2341 emit_insn (gen_altivec_vspltish (vones, const1_rtx));
2342 emit_insn (gen_altivec_vmsumshm (operands[0], operands[1], vones, operands[2]));
2346 (define_expand "vec_unpacks_hi_v16qi"
2347 [(set (match_operand:V8HI 0 "register_operand" "=v")
2348 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
2353 emit_insn (gen_altivec_vupkhsb (operands[0], operands[1]));
2357 (define_expand "vec_unpacks_hi_v8hi"
2358 [(set (match_operand:V4SI 0 "register_operand" "=v")
2359 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
2364 emit_insn (gen_altivec_vupkhsh (operands[0], operands[1]));
2368 (define_expand "vec_unpacks_lo_v16qi"
2369 [(set (match_operand:V8HI 0 "register_operand" "=v")
2370 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
2375 emit_insn (gen_altivec_vupklsb (operands[0], operands[1]));
2379 (define_expand "vec_unpacks_lo_v8hi"
2380 [(set (match_operand:V4SI 0 "register_operand" "=v")
2381 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
2386 emit_insn (gen_altivec_vupklsh (operands[0], operands[1]));
2390 (define_insn "vperm_v8hiv4si"
2391 [(set (match_operand:V4SI 0 "register_operand" "=v")
2392 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
2393 (match_operand:V4SI 2 "register_operand" "v")
2394 (match_operand:V16QI 3 "register_operand" "v")]
2398 [(set_attr "type" "vecperm")])
2400 (define_insn "vperm_v16qiv8hi"
2401 [(set (match_operand:V8HI 0 "register_operand" "=v")
2402 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
2403 (match_operand:V8HI 2 "register_operand" "v")
2404 (match_operand:V16QI 3 "register_operand" "v")]
2408 [(set_attr "type" "vecperm")])
2410 (define_expand "vec_unpacku_hi_v16qi"
2411 [(set (match_operand:V8HI 0 "register_operand" "=v")
2412 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
2417 rtx vzero = gen_reg_rtx (V8HImode);
2418 rtx mask = gen_reg_rtx (V16QImode);
2419 rtvec v = rtvec_alloc (16);
2421 emit_insn (gen_altivec_vspltish (vzero, const0_rtx));
2423 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16);
2424 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 0);
2425 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 16);
2426 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 1);
2427 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16);
2428 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 2);
2429 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 16);
2430 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 3);
2431 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2432 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 4);
2433 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 16);
2434 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 5);
2435 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16);
2436 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 6);
2437 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 16);
2438 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 7);
2440 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2441 emit_insn (gen_vperm_v16qiv8hi (operands[0], operands[1], vzero, mask));
2445 (define_expand "vec_unpacku_hi_v8hi"
2446 [(set (match_operand:V4SI 0 "register_operand" "=v")
2447 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
2452 rtx vzero = gen_reg_rtx (V4SImode);
2453 rtx mask = gen_reg_rtx (V16QImode);
2454 rtvec v = rtvec_alloc (16);
2456 emit_insn (gen_altivec_vspltisw (vzero, const0_rtx));
2458 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16);
2459 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 17);
2460 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 0);
2461 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 1);
2462 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16);
2463 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 17);
2464 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 2);
2465 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 3);
2466 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2467 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 17);
2468 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 4);
2469 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 5);
2470 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16);
2471 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 17);
2472 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 6);
2473 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 7);
2475 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2476 emit_insn (gen_vperm_v8hiv4si (operands[0], operands[1], vzero, mask));
2480 (define_expand "vec_unpacku_lo_v16qi"
2481 [(set (match_operand:V8HI 0 "register_operand" "=v")
2482 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
2487 rtx vzero = gen_reg_rtx (V8HImode);
2488 rtx mask = gen_reg_rtx (V16QImode);
2489 rtvec v = rtvec_alloc (16);
2491 emit_insn (gen_altivec_vspltish (vzero, const0_rtx));
2493 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16);
2494 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 8);
2495 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 16);
2496 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 9);
2497 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16);
2498 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 10);
2499 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 16);
2500 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 11);
2501 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2502 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 12);
2503 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 16);
2504 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 13);
2505 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16);
2506 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 14);
2507 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 16);
2508 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 15);
2510 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2511 emit_insn (gen_vperm_v16qiv8hi (operands[0], operands[1], vzero, mask));
2515 (define_expand "vec_unpacku_lo_v8hi"
2516 [(set (match_operand:V4SI 0 "register_operand" "=v")
2517 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
2522 rtx vzero = gen_reg_rtx (V4SImode);
2523 rtx mask = gen_reg_rtx (V16QImode);
2524 rtvec v = rtvec_alloc (16);
2526 emit_insn (gen_altivec_vspltisw (vzero, const0_rtx));
2528 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16);
2529 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 17);
2530 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 8);
2531 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 9);
2532 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16);
2533 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 17);
2534 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 10);
2535 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 11);
2536 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2537 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 17);
2538 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 12);
2539 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 13);
2540 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16);
2541 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 17);
2542 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 14);
2543 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 15);
2545 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2546 emit_insn (gen_vperm_v8hiv4si (operands[0], operands[1], vzero, mask));
2550 (define_expand "vec_widen_umult_hi_v16qi"
2551 [(set (match_operand:V8HI 0 "register_operand" "=v")
2552 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
2553 (match_operand:V16QI 2 "register_operand" "v")]
2558 rtx ve = gen_reg_rtx (V8HImode);
2559 rtx vo = gen_reg_rtx (V8HImode);
2561 emit_insn (gen_altivec_vmuleub (ve, operands[1], operands[2]));
2562 emit_insn (gen_altivec_vmuloub (vo, operands[1], operands[2]));
2563 emit_insn (gen_altivec_vmrghh (operands[0], ve, vo));
2567 (define_expand "vec_widen_umult_lo_v16qi"
2568 [(set (match_operand:V8HI 0 "register_operand" "=v")
2569 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
2570 (match_operand:V16QI 2 "register_operand" "v")]
2575 rtx ve = gen_reg_rtx (V8HImode);
2576 rtx vo = gen_reg_rtx (V8HImode);
2578 emit_insn (gen_altivec_vmuleub (ve, operands[1], operands[2]));
2579 emit_insn (gen_altivec_vmuloub (vo, operands[1], operands[2]));
2580 emit_insn (gen_altivec_vmrglh (operands[0], ve, vo));
2584 (define_expand "vec_widen_smult_hi_v16qi"
2585 [(set (match_operand:V8HI 0 "register_operand" "=v")
2586 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
2587 (match_operand:V16QI 2 "register_operand" "v")]
2592 rtx ve = gen_reg_rtx (V8HImode);
2593 rtx vo = gen_reg_rtx (V8HImode);
2595 emit_insn (gen_altivec_vmulesb (ve, operands[1], operands[2]));
2596 emit_insn (gen_altivec_vmulosb (vo, operands[1], operands[2]));
2597 emit_insn (gen_altivec_vmrghh (operands[0], ve, vo));
2601 (define_expand "vec_widen_smult_lo_v16qi"
2602 [(set (match_operand:V8HI 0 "register_operand" "=v")
2603 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
2604 (match_operand:V16QI 2 "register_operand" "v")]
2609 rtx ve = gen_reg_rtx (V8HImode);
2610 rtx vo = gen_reg_rtx (V8HImode);
2612 emit_insn (gen_altivec_vmulesb (ve, operands[1], operands[2]));
2613 emit_insn (gen_altivec_vmulosb (vo, operands[1], operands[2]));
2614 emit_insn (gen_altivec_vmrglh (operands[0], ve, vo));
2618 (define_expand "vec_widen_umult_hi_v8hi"
2619 [(set (match_operand:V4SI 0 "register_operand" "=v")
2620 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
2621 (match_operand:V8HI 2 "register_operand" "v")]
2626 rtx ve = gen_reg_rtx (V4SImode);
2627 rtx vo = gen_reg_rtx (V4SImode);
2629 emit_insn (gen_altivec_vmuleuh (ve, operands[1], operands[2]));
2630 emit_insn (gen_altivec_vmulouh (vo, operands[1], operands[2]));
2631 emit_insn (gen_altivec_vmrghw (operands[0], ve, vo));
2635 (define_expand "vec_widen_umult_lo_v8hi"
2636 [(set (match_operand:V4SI 0 "register_operand" "=v")
2637 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
2638 (match_operand:V8HI 2 "register_operand" "v")]
2643 rtx ve = gen_reg_rtx (V4SImode);
2644 rtx vo = gen_reg_rtx (V4SImode);
2646 emit_insn (gen_altivec_vmuleuh (ve, operands[1], operands[2]));
2647 emit_insn (gen_altivec_vmulouh (vo, operands[1], operands[2]));
2648 emit_insn (gen_altivec_vmrglw (operands[0], ve, vo));
2652 (define_expand "vec_widen_smult_hi_v8hi"
2653 [(set (match_operand:V4SI 0 "register_operand" "=v")
2654 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
2655 (match_operand:V8HI 2 "register_operand" "v")]
2660 rtx ve = gen_reg_rtx (V4SImode);
2661 rtx vo = gen_reg_rtx (V4SImode);
2663 emit_insn (gen_altivec_vmulesh (ve, operands[1], operands[2]));
2664 emit_insn (gen_altivec_vmulosh (vo, operands[1], operands[2]));
2665 emit_insn (gen_altivec_vmrghw (operands[0], ve, vo));
2669 (define_expand "vec_widen_smult_lo_v8hi"
2670 [(set (match_operand:V4SI 0 "register_operand" "=v")
2671 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
2672 (match_operand:V8HI 2 "register_operand" "v")]
2677 rtx ve = gen_reg_rtx (V4SImode);
2678 rtx vo = gen_reg_rtx (V4SImode);
2680 emit_insn (gen_altivec_vmulesh (ve, operands[1], operands[2]));
2681 emit_insn (gen_altivec_vmulosh (vo, operands[1], operands[2]));
2682 emit_insn (gen_altivec_vmrglw (operands[0], ve, vo));
2686 (define_expand "vec_pack_mod_v8hi"
2687 [(set (match_operand:V16QI 0 "register_operand" "=v")
2688 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
2689 (match_operand:V8HI 2 "register_operand" "v")]
2694 emit_insn (gen_altivec_vpkuhum (operands[0], operands[1], operands[2]));
2698 (define_expand "vec_pack_mod_v4si"
2699 [(set (match_operand:V8HI 0 "register_operand" "=v")
2700 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
2701 (match_operand:V4SI 2 "register_operand" "v")]
2706 emit_insn (gen_altivec_vpkuwum (operands[0], operands[1], operands[2]));
2710 ;; Can't map smulv8hi3_highpart to altivec_vmhaddshs because it
2711 ;; computes sat16((op0*op1)>>15 + 0)
2712 ;; rather than truncate((op0*op1)>>16)
2713 ;(define_expand "smulv8hi3_highpart"
2714 ; [(set (match_operand:V8HI 0 "register_operand" "=v")
2715 ; (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
2716 ; (match_operand:V8HI 2 "register_operand" "v")]
2717 ; UNSPEC_VMHADDSHS))
2718 ; (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
2722 ; rtx vzero = gen_reg_rtx (V8HImode);
2724 ; emit_insn (gen_altivec_vspltish (vzero, const0_rtx));
2725 ; emit_insn (gen_altivec_vmhaddshs (operands[0], operands[1], operands[2], vzero));
2730 (define_insn "vpkuhum_nomode"
2731 [(set (match_operand:V16QI 0 "register_operand" "=v")
2732 (unspec:V16QI [(match_operand 1 "register_operand" "v")
2733 (match_operand 2 "register_operand" "v")]
2737 [(set_attr "type" "vecperm")])
2739 (define_insn "vpkuwum_nomode"
2740 [(set (match_operand:V8HI 0 "register_operand" "=v")
2741 (unspec:V8HI [(match_operand 1 "register_operand" "v")
2742 (match_operand 2 "register_operand" "v")]
2746 [(set_attr "type" "vecperm")])
2748 (define_expand "vec_interleave_highv4sf"
2749 [(set (match_operand:V4SF 0 "register_operand" "")
2750 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "")
2751 (match_operand:V4SF 2 "register_operand" "")]
2752 UNSPEC_INTERHI_V4SF))]
2756 emit_insn (gen_altivec_vmrghsf (operands[0], operands[1], operands[2]));
2760 (define_expand "vec_interleave_lowv4sf"
2761 [(set (match_operand:V4SF 0 "register_operand" "")
2762 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "")
2763 (match_operand:V4SF 2 "register_operand" "")]
2764 UNSPEC_INTERLO_V4SF))]
2768 emit_insn (gen_altivec_vmrglsf (operands[0], operands[1], operands[2]));
2772 (define_expand "vec_interleave_high<mode>"
2773 [(set (match_operand:VI 0 "register_operand" "")
2774 (unspec:VI [(match_operand:VI 1 "register_operand" "")
2775 (match_operand:VI 2 "register_operand" "")]
2780 emit_insn (gen_altivec_vmrgh<VI_char> (operands[0], operands[1], operands[2]));
2784 (define_expand "vec_interleave_low<mode>"
2785 [(set (match_operand:VI 0 "register_operand" "")
2786 (unspec:VI [(match_operand:VI 1 "register_operand" "")
2787 (match_operand:VI 2 "register_operand" "")]
2792 emit_insn (gen_altivec_vmrgl<VI_char> (operands[0], operands[1], operands[2]));
2796 (define_expand "ashl<mode>3"
2797 [(set (match_operand:VI 0 "register_operand" "")
2798 (unspec:V8HI [(match_operand:VI 1 "register_operand" "")
2799 (match_operand:VI 2 "register_operand" "")]
2804 emit_insn (gen_altivec_vsl<VI_char> (operands[0], operands[1], operands[2]));
2809 (define_expand "vec_extract_evenv4si"
2810 [(set (match_operand:V4SI 0 "register_operand" "")
2811 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "")
2812 (match_operand:V4SI 2 "register_operand" "")]
2813 UNSPEC_EXTEVEN_V4SI))]
2817 rtx mask = gen_reg_rtx (V16QImode);
2818 rtvec v = rtvec_alloc (16);
2820 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 0);
2821 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 1);
2822 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 2);
2823 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 3);
2824 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 8);
2825 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 9);
2826 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 10);
2827 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 11);
2828 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2829 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 17);
2830 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 18);
2831 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 19);
2832 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 24);
2833 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 25);
2834 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 26);
2835 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 27);
2836 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2837 emit_insn (gen_altivec_vperm_v4si (operands[0], operands[1], operands[2], mask));
2842 (define_expand "vec_extract_evenv4sf"
2843 [(set (match_operand:V4SF 0 "register_operand" "")
2844 (unspec:V8HI [(match_operand:V4SF 1 "register_operand" "")
2845 (match_operand:V4SF 2 "register_operand" "")]
2846 UNSPEC_EXTEVEN_V4SF))]
2850 rtx mask = gen_reg_rtx (V16QImode);
2851 rtvec v = rtvec_alloc (16);
2853 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 0);
2854 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 1);
2855 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 2);
2856 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 3);
2857 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 8);
2858 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 9);
2859 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 10);
2860 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 11);
2861 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2862 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 17);
2863 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 18);
2864 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 19);
2865 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 24);
2866 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 25);
2867 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 26);
2868 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 27);
2869 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2870 emit_insn (gen_altivec_vperm_v4sf (operands[0], operands[1], operands[2], mask));
2875 (define_expand "vec_extract_evenv8hi"
2876 [(set (match_operand:V4SI 0 "register_operand" "")
2877 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "")
2878 (match_operand:V8HI 2 "register_operand" "")]
2879 UNSPEC_EXTEVEN_V8HI))]
2883 rtx mask = gen_reg_rtx (V16QImode);
2884 rtvec v = rtvec_alloc (16);
2886 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 0);
2887 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 1);
2888 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 4);
2889 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 5);
2890 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 8);
2891 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 9);
2892 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 12);
2893 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 13);
2894 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2895 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 17);
2896 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 20);
2897 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 21);
2898 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 24);
2899 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 25);
2900 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 28);
2901 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 29);
2902 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2903 emit_insn (gen_altivec_vperm_v8hi (operands[0], operands[1], operands[2], mask));
2908 (define_expand "vec_extract_evenv16qi"
2909 [(set (match_operand:V4SI 0 "register_operand" "")
2910 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "")
2911 (match_operand:V16QI 2 "register_operand" "")]
2912 UNSPEC_EXTEVEN_V16QI))]
2916 rtx mask = gen_reg_rtx (V16QImode);
2917 rtvec v = rtvec_alloc (16);
2919 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 0);
2920 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 2);
2921 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 4);
2922 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 6);
2923 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 8);
2924 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 10);
2925 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 12);
2926 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 14);
2927 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2928 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 18);
2929 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 20);
2930 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 22);
2931 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 24);
2932 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 26);
2933 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 28);
2934 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 30);
2935 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2936 emit_insn (gen_altivec_vperm_v16qi (operands[0], operands[1], operands[2], mask));
2941 (define_expand "vec_extract_oddv4si"
2942 [(set (match_operand:V4SI 0 "register_operand" "")
2943 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "")
2944 (match_operand:V4SI 2 "register_operand" "")]
2945 UNSPEC_EXTODD_V4SI))]
2949 rtx mask = gen_reg_rtx (V16QImode);
2950 rtvec v = rtvec_alloc (16);
2952 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 4);
2953 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 5);
2954 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 6);
2955 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 7);
2956 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 12);
2957 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 13);
2958 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 14);
2959 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 15);
2960 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 20);
2961 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 21);
2962 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 22);
2963 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 23);
2964 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 28);
2965 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 29);
2966 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 30);
2967 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 31);
2968 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2969 emit_insn (gen_altivec_vperm_v4si (operands[0], operands[1], operands[2], mask));
2974 (define_expand "vec_extract_oddv4sf"
2975 [(set (match_operand:V4SF 0 "register_operand" "")
2976 (unspec:V8HI [(match_operand:V4SF 1 "register_operand" "")
2977 (match_operand:V4SF 2 "register_operand" "")]
2978 UNSPEC_EXTODD_V4SF))]
2982 rtx mask = gen_reg_rtx (V16QImode);
2983 rtvec v = rtvec_alloc (16);
2985 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 4);
2986 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 5);
2987 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 6);
2988 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 7);
2989 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 12);
2990 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 13);
2991 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 14);
2992 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 15);
2993 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 20);
2994 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 21);
2995 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 22);
2996 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 23);
2997 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 28);
2998 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 29);
2999 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 30);
3000 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 31);
3001 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
3002 emit_insn (gen_altivec_vperm_v4sf (operands[0], operands[1], operands[2], mask));
3007 (define_expand "vec_extract_oddv8hi"
3008 [(set (match_operand:V8HI 0 "register_operand" "")
3009 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "")
3010 (match_operand:V8HI 2 "register_operand" "")]
3011 UNSPEC_EXTODD_V8HI))]
3015 emit_insn (gen_vpkuwum_nomode (operands[0], operands[1], operands[2]));
3019 (define_expand "vec_extract_oddv16qi"
3020 [(set (match_operand:V16QI 0 "register_operand" "")
3021 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "")
3022 (match_operand:V16QI 2 "register_operand" "")]
3023 UNSPEC_EXTODD_V16QI))]
3027 emit_insn (gen_vpkuhum_nomode (operands[0], operands[1], operands[2]));