2 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006 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)
89 (UNSPEC_VRSQRTEFP 157)
102 (UNSPEC_PREDICATE 173)
113 (UNSPEC_SET_VSCR 213)
114 (UNSPEC_GET_VRSAVE 214)
115 (UNSPEC_REALIGN_LOAD 215)
116 (UNSPEC_REDUC_PLUS 217)
118 (UNSPEC_EXTEVEN_V4SI 220)
119 (UNSPEC_EXTEVEN_V8HI 221)
120 (UNSPEC_EXTEVEN_V16QI 222)
121 (UNSPEC_EXTEVEN_V4SF 223)
122 (UNSPEC_EXTODD_V4SI 224)
123 (UNSPEC_EXTODD_V8HI 225)
124 (UNSPEC_EXTODD_V16QI 226)
125 (UNSPEC_EXTODD_V4SF 227)
126 (UNSPEC_INTERHI_V4SI 228)
127 (UNSPEC_INTERHI_V8HI 229)
128 (UNSPEC_INTERHI_V16QI 230)
129 (UNSPEC_INTERHI_V4SF 231)
130 (UNSPEC_INTERLO_V4SI 232)
131 (UNSPEC_INTERLO_V8HI 233)
132 (UNSPEC_INTERLO_V16QI 234)
133 (UNSPEC_INTERLO_V4SF 235)
134 (UNSPEC_VMULWHUB 308)
135 (UNSPEC_VMULWLUB 309)
136 (UNSPEC_VMULWHSB 310)
137 (UNSPEC_VMULWLSB 311)
138 (UNSPEC_VMULWHUH 312)
139 (UNSPEC_VMULWLUH 313)
140 (UNSPEC_VMULWHSH 314)
141 (UNSPEC_VMULWLSH 315)
153 [(UNSPECV_SET_VRSAVE 30)
161 (define_mode_macro VI [V4SI V8HI V16QI])
162 ;; Short vec in modes
163 (define_mode_macro VIshort [V8HI V16QI])
165 (define_mode_macro VF [V4SF])
166 ;; Vec modes, pity mode macros are not composable
167 (define_mode_macro V [V4SI V8HI V16QI V4SF])
169 (define_mode_attr VI_char [(V4SI "w") (V8HI "h") (V16QI "b")])
171 ;; Generic LVX load instruction.
172 (define_insn "altivec_lvx_<mode>"
173 [(set (match_operand:V 0 "altivec_register_operand" "=v")
174 (match_operand:V 1 "memory_operand" "Z"))]
177 [(set_attr "type" "vecload")])
179 ;; Generic STVX store instruction.
180 (define_insn "altivec_stvx_<mode>"
181 [(set (match_operand:V 0 "memory_operand" "=Z")
182 (match_operand:V 1 "altivec_register_operand" "v"))]
185 [(set_attr "type" "vecstore")])
187 ;; Vector move instructions.
188 (define_expand "mov<mode>"
189 [(set (match_operand:V 0 "nonimmediate_operand" "")
190 (match_operand:V 1 "any_operand" ""))]
193 rs6000_emit_move (operands[0], operands[1], <MODE>mode);
197 (define_insn "*mov<mode>_internal"
198 [(set (match_operand:V 0 "nonimmediate_operand" "=Z,v,v,o,r,r,v")
199 (match_operand:V 1 "input_operand" "v,Z,v,r,o,r,W"))]
201 && (register_operand (operands[0], <MODE>mode)
202 || register_operand (operands[1], <MODE>mode))"
204 switch (which_alternative)
206 case 0: return "stvx %1,%y0";
207 case 1: return "lvx %0,%y1";
208 case 2: return "vor %0,%1,%1";
212 case 6: return output_vec_const_move (operands);
213 default: gcc_unreachable ();
216 [(set_attr "type" "vecstore,vecload,vecsimple,store,load,*,*")])
219 [(set (match_operand:V4SI 0 "nonimmediate_operand" "")
220 (match_operand:V4SI 1 "input_operand" ""))]
221 "TARGET_ALTIVEC && reload_completed
222 && gpr_or_gpr_p (operands[0], operands[1])"
225 rs6000_split_multireg_move (operands[0], operands[1]); DONE;
229 [(set (match_operand:V8HI 0 "nonimmediate_operand" "")
230 (match_operand:V8HI 1 "input_operand" ""))]
231 "TARGET_ALTIVEC && reload_completed
232 && gpr_or_gpr_p (operands[0], operands[1])"
234 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
237 [(set (match_operand:V16QI 0 "nonimmediate_operand" "")
238 (match_operand:V16QI 1 "input_operand" ""))]
239 "TARGET_ALTIVEC && reload_completed
240 && gpr_or_gpr_p (operands[0], operands[1])"
242 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
245 [(set (match_operand:V4SF 0 "nonimmediate_operand" "")
246 (match_operand:V4SF 1 "input_operand" ""))]
247 "TARGET_ALTIVEC && reload_completed
248 && gpr_or_gpr_p (operands[0], operands[1])"
251 rs6000_split_multireg_move (operands[0], operands[1]); DONE;
255 [(set (match_operand:VI 0 "altivec_register_operand" "")
256 (match_operand:VI 1 "easy_vector_constant_add_self" ""))]
257 "TARGET_ALTIVEC && reload_completed"
258 [(set (match_dup 0) (match_dup 3))
259 (set (match_dup 0) (plus:VI (match_dup 0)
262 rtx dup = gen_easy_altivec_constant (operands[1]);
265 /* Divide the operand of the resulting VEC_DUPLICATE, and use
266 simplify_rtx to make a CONST_VECTOR. */
267 XEXP (dup, 0) = simplify_const_binary_operation (ASHIFTRT, QImode,
268 XEXP (dup, 0), const1_rtx);
269 const_vec = simplify_rtx (dup);
271 if (GET_MODE (const_vec) == <MODE>mode)
272 operands[3] = const_vec;
274 operands[3] = gen_lowpart (<MODE>mode, const_vec);
277 (define_insn "get_vrsave_internal"
278 [(set (match_operand:SI 0 "register_operand" "=r")
279 (unspec:SI [(reg:SI 109)] UNSPEC_GET_VRSAVE))]
283 return "mfspr %0,256";
285 return "mfvrsave %0";
287 [(set_attr "type" "*")])
289 (define_insn "*set_vrsave_internal"
290 [(match_parallel 0 "vrsave_operation"
292 (unspec_volatile:SI [(match_operand:SI 1 "register_operand" "r")
293 (reg:SI 109)] UNSPECV_SET_VRSAVE))])]
297 return "mtspr 256,%1";
299 return "mtvrsave %1";
301 [(set_attr "type" "*")])
303 (define_insn "*save_world"
304 [(match_parallel 0 "save_world_operation"
305 [(clobber (match_operand:SI 1 "register_operand" "=l"))
306 (use (match_operand:SI 2 "call_operand" "s"))])]
307 "TARGET_MACHO && (DEFAULT_ABI == ABI_DARWIN) && TARGET_32BIT"
309 [(set_attr "type" "branch")
310 (set_attr "length" "4")])
312 (define_insn "*restore_world"
313 [(match_parallel 0 "restore_world_operation"
316 (use (match_operand:SI 2 "call_operand" "s"))
317 (clobber (match_operand:SI 3 "gpc_reg_operand" "=r"))])]
318 "TARGET_MACHO && (DEFAULT_ABI == ABI_DARWIN) && TARGET_32BIT"
321 ;; Simple binary operations.
324 (define_insn "add<mode>3"
325 [(set (match_operand:VI 0 "register_operand" "=v")
326 (plus:VI (match_operand:VI 1 "register_operand" "v")
327 (match_operand:VI 2 "register_operand" "v")))]
329 "vaddu<VI_char>m %0,%1,%2"
330 [(set_attr "type" "vecsimple")])
332 (define_insn "addv4sf3"
333 [(set (match_operand:V4SF 0 "register_operand" "=v")
334 (plus:V4SF (match_operand:V4SF 1 "register_operand" "v")
335 (match_operand:V4SF 2 "register_operand" "v")))]
338 [(set_attr "type" "vecfloat")])
340 (define_insn "altivec_vaddcuw"
341 [(set (match_operand:V4SI 0 "register_operand" "=v")
342 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
343 (match_operand:V4SI 2 "register_operand" "v")]
347 [(set_attr "type" "vecsimple")])
349 (define_insn "altivec_vaddu<VI_char>s"
350 [(set (match_operand:VI 0 "register_operand" "=v")
351 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
352 (match_operand:VI 2 "register_operand" "v")]
354 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
356 "vaddu<VI_char>s %0,%1,%2"
357 [(set_attr "type" "vecsimple")])
359 (define_insn "altivec_vadds<VI_char>s"
360 [(set (match_operand:VI 0 "register_operand" "=v")
361 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
362 (match_operand:VI 2 "register_operand" "v")]
364 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
366 "vadds<VI_char>s %0,%1,%2"
367 [(set_attr "type" "vecsimple")])
370 (define_insn "sub<mode>3"
371 [(set (match_operand:VI 0 "register_operand" "=v")
372 (minus:VI (match_operand:VI 1 "register_operand" "v")
373 (match_operand:VI 2 "register_operand" "v")))]
375 "vsubu<VI_char>m %0,%1,%2"
376 [(set_attr "type" "vecsimple")])
378 (define_insn "subv4sf3"
379 [(set (match_operand:V4SF 0 "register_operand" "=v")
380 (minus:V4SF (match_operand:V4SF 1 "register_operand" "v")
381 (match_operand:V4SF 2 "register_operand" "v")))]
384 [(set_attr "type" "vecfloat")])
386 (define_insn "altivec_vsubcuw"
387 [(set (match_operand:V4SI 0 "register_operand" "=v")
388 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
389 (match_operand:V4SI 2 "register_operand" "v")]
393 [(set_attr "type" "vecsimple")])
395 (define_insn "altivec_vsubu<VI_char>s"
396 [(set (match_operand:VI 0 "register_operand" "=v")
397 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
398 (match_operand:VI 2 "register_operand" "v")]
400 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
402 "vsubu<VI_char>s %0,%1,%2"
403 [(set_attr "type" "vecsimple")])
405 (define_insn "altivec_vsubs<VI_char>s"
406 [(set (match_operand:VI 0 "register_operand" "=v")
407 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
408 (match_operand:VI 2 "register_operand" "v")]
410 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
412 "vsubs<VI_char>s %0,%1,%2"
413 [(set_attr "type" "vecsimple")])
416 (define_insn "altivec_vavgu<VI_char>"
417 [(set (match_operand:VI 0 "register_operand" "=v")
418 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
419 (match_operand:VI 2 "register_operand" "v")]
422 "vavgu<VI_char> %0,%1,%2"
423 [(set_attr "type" "vecsimple")])
425 (define_insn "altivec_vavgs<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 "vavgs<VI_char> %0,%1,%2"
432 [(set_attr "type" "vecsimple")])
434 (define_insn "altivec_vcmpbfp"
435 [(set (match_operand:V4SI 0 "register_operand" "=v")
436 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
437 (match_operand:V4SF 2 "register_operand" "v")]
441 [(set_attr "type" "veccmp")])
443 (define_insn "altivec_vcmpequb"
444 [(set (match_operand:V16QI 0 "register_operand" "=v")
445 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
446 (match_operand:V16QI 2 "register_operand" "v")]
450 [(set_attr "type" "vecsimple")])
452 (define_insn "altivec_vcmpequh"
453 [(set (match_operand:V8HI 0 "register_operand" "=v")
454 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
455 (match_operand:V8HI 2 "register_operand" "v")]
459 [(set_attr "type" "vecsimple")])
461 (define_insn "altivec_vcmpequw"
462 [(set (match_operand:V4SI 0 "register_operand" "=v")
463 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
464 (match_operand:V4SI 2 "register_operand" "v")]
468 [(set_attr "type" "vecsimple")])
470 (define_insn "altivec_vcmpeqfp"
471 [(set (match_operand:V4SI 0 "register_operand" "=v")
472 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
473 (match_operand:V4SF 2 "register_operand" "v")]
477 [(set_attr "type" "veccmp")])
479 (define_insn "altivec_vcmpgefp"
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_vcmpgtub"
489 [(set (match_operand:V16QI 0 "register_operand" "=v")
490 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
491 (match_operand:V16QI 2 "register_operand" "v")]
495 [(set_attr "type" "vecsimple")])
497 (define_insn "altivec_vcmpgtsb"
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_vcmpgtuh"
507 [(set (match_operand:V8HI 0 "register_operand" "=v")
508 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
509 (match_operand:V8HI 2 "register_operand" "v")]
513 [(set_attr "type" "vecsimple")])
515 (define_insn "altivec_vcmpgtsh"
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_vcmpgtuw"
525 [(set (match_operand:V4SI 0 "register_operand" "=v")
526 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
527 (match_operand:V4SI 2 "register_operand" "v")]
531 [(set_attr "type" "vecsimple")])
533 (define_insn "altivec_vcmpgtsw"
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_vcmpgtfp"
543 [(set (match_operand:V4SI 0 "register_operand" "=v")
544 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
545 (match_operand:V4SF 2 "register_operand" "v")]
549 [(set_attr "type" "veccmp")])
551 ;; Fused multiply add
552 (define_insn "altivec_vmaddfp"
553 [(set (match_operand:V4SF 0 "register_operand" "=v")
554 (plus:V4SF (mult:V4SF (match_operand:V4SF 1 "register_operand" "v")
555 (match_operand:V4SF 2 "register_operand" "v"))
556 (match_operand:V4SF 3 "register_operand" "v")))]
558 "vmaddfp %0,%1,%2,%3"
559 [(set_attr "type" "vecfloat")])
561 ;; We do multiply as a fused multiply-add with an add of a -0.0 vector.
563 (define_expand "mulv4sf3"
564 [(use (match_operand:V4SF 0 "register_operand" ""))
565 (use (match_operand:V4SF 1 "register_operand" ""))
566 (use (match_operand:V4SF 2 "register_operand" ""))]
567 "TARGET_ALTIVEC && TARGET_FUSED_MADD"
572 /* Generate [-0.0, -0.0, -0.0, -0.0]. */
573 neg0 = gen_reg_rtx (V4SImode);
574 emit_insn (gen_altivec_vspltisw (neg0, constm1_rtx));
575 emit_insn (gen_altivec_vslw (neg0, neg0, neg0));
577 /* Use the multiply-add. */
578 emit_insn (gen_altivec_vmaddfp (operands[0], operands[1], operands[2],
579 gen_lowpart (V4SFmode, neg0)));
583 ;; 32-bit integer multiplication
584 ;; A_high = Operand_0 & 0xFFFF0000 >> 16
585 ;; A_low = Operand_0 & 0xFFFF
586 ;; B_high = Operand_1 & 0xFFFF0000 >> 16
587 ;; B_low = Operand_1 & 0xFFFF
588 ;; result = A_low * B_low + (A_high * B_low + B_high * A_low) << 16
590 ;; (define_insn "mulv4si3"
591 ;; [(set (match_operand:V4SI 0 "register_operand" "=v")
592 ;; (mult:V4SI (match_operand:V4SI 1 "register_operand" "v")
593 ;; (match_operand:V4SI 2 "register_operand" "v")))]
594 (define_expand "mulv4si3"
595 [(use (match_operand:V4SI 0 "register_operand" ""))
596 (use (match_operand:V4SI 1 "register_operand" ""))
597 (use (match_operand:V4SI 2 "register_operand" ""))]
610 zero = gen_reg_rtx (V4SImode);
611 emit_insn (gen_altivec_vspltisw (zero, const0_rtx));
613 sixteen = gen_reg_rtx (V4SImode);
614 emit_insn (gen_altivec_vspltisw (sixteen, gen_rtx_CONST_INT (V4SImode, -16)));
616 swap = gen_reg_rtx (V4SImode);
617 emit_insn (gen_altivec_vrlw (swap, operands[2], sixteen));
619 one = gen_reg_rtx (V8HImode);
620 convert_move (one, operands[1], 0);
622 two = gen_reg_rtx (V8HImode);
623 convert_move (two, operands[2], 0);
625 small_swap = gen_reg_rtx (V8HImode);
626 convert_move (small_swap, swap, 0);
628 low_product = gen_reg_rtx (V4SImode);
629 emit_insn (gen_altivec_vmulouh (low_product, one, two));
631 high_product = gen_reg_rtx (V4SImode);
632 emit_insn (gen_altivec_vmsumuhm (high_product, one, small_swap, zero));
634 emit_insn (gen_altivec_vslw (high_product, high_product, sixteen));
636 emit_insn (gen_addv4si3 (operands[0], high_product, low_product));
642 ;; Fused multiply subtract
643 (define_insn "altivec_vnmsubfp"
644 [(set (match_operand:V4SF 0 "register_operand" "=v")
645 (neg:V4SF (minus:V4SF (mult:V4SF (match_operand:V4SF 1 "register_operand" "v")
646 (match_operand:V4SF 2 "register_operand" "v"))
647 (match_operand:V4SF 3 "register_operand" "v"))))]
649 "vnmsubfp %0,%1,%2,%3"
650 [(set_attr "type" "vecfloat")])
652 (define_insn "altivec_vmsumu<VI_char>m"
653 [(set (match_operand:V4SI 0 "register_operand" "=v")
654 (unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v")
655 (match_operand:VIshort 2 "register_operand" "v")
656 (match_operand:V4SI 3 "register_operand" "v")]
659 "vmsumu<VI_char>m %0,%1,%2,%3"
660 [(set_attr "type" "veccomplex")])
662 (define_insn "altivec_vmsumm<VI_char>m"
663 [(set (match_operand:V4SI 0 "register_operand" "=v")
664 (unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v")
665 (match_operand:VIshort 2 "register_operand" "v")
666 (match_operand:V4SI 3 "register_operand" "v")]
669 "vmsumm<VI_char>m %0,%1,%2,%3"
670 [(set_attr "type" "veccomplex")])
672 (define_insn "altivec_vmsumshm"
673 [(set (match_operand:V4SI 0 "register_operand" "=v")
674 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
675 (match_operand:V8HI 2 "register_operand" "v")
676 (match_operand:V4SI 3 "register_operand" "v")]
679 "vmsumshm %0,%1,%2,%3"
680 [(set_attr "type" "veccomplex")])
682 (define_insn "altivec_vmsumuhs"
683 [(set (match_operand:V4SI 0 "register_operand" "=v")
684 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
685 (match_operand:V8HI 2 "register_operand" "v")
686 (match_operand:V4SI 3 "register_operand" "v")]
688 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
690 "vmsumuhs %0,%1,%2,%3"
691 [(set_attr "type" "veccomplex")])
693 (define_insn "altivec_vmsumshs"
694 [(set (match_operand:V4SI 0 "register_operand" "=v")
695 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
696 (match_operand:V8HI 2 "register_operand" "v")
697 (match_operand:V4SI 3 "register_operand" "v")]
699 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
701 "vmsumshs %0,%1,%2,%3"
702 [(set_attr "type" "veccomplex")])
706 (define_insn "umax<mode>3"
707 [(set (match_operand:VI 0 "register_operand" "=v")
708 (umax:VI (match_operand:VI 1 "register_operand" "v")
709 (match_operand:VI 2 "register_operand" "v")))]
711 "vmaxu<VI_char> %0,%1,%2"
712 [(set_attr "type" "vecsimple")])
714 (define_insn "smax<mode>3"
715 [(set (match_operand:VI 0 "register_operand" "=v")
716 (smax:VI (match_operand:VI 1 "register_operand" "v")
717 (match_operand:VI 2 "register_operand" "v")))]
719 "vmaxs<VI_char> %0,%1,%2"
720 [(set_attr "type" "vecsimple")])
722 (define_insn "smaxv4sf3"
723 [(set (match_operand:V4SF 0 "register_operand" "=v")
724 (smax:V4SF (match_operand:V4SF 1 "register_operand" "v")
725 (match_operand:V4SF 2 "register_operand" "v")))]
728 [(set_attr "type" "veccmp")])
730 (define_insn "umin<mode>3"
731 [(set (match_operand:VI 0 "register_operand" "=v")
732 (umin:VI (match_operand:VI 1 "register_operand" "v")
733 (match_operand:VI 2 "register_operand" "v")))]
735 "vminu<VI_char> %0,%1,%2"
736 [(set_attr "type" "vecsimple")])
738 (define_insn "smin<mode>3"
739 [(set (match_operand:VI 0 "register_operand" "=v")
740 (smin:VI (match_operand:VI 1 "register_operand" "v")
741 (match_operand:VI 2 "register_operand" "v")))]
743 "vmins<VI_char> %0,%1,%2"
744 [(set_attr "type" "vecsimple")])
746 (define_insn "sminv4sf3"
747 [(set (match_operand:V4SF 0 "register_operand" "=v")
748 (smin:V4SF (match_operand:V4SF 1 "register_operand" "v")
749 (match_operand:V4SF 2 "register_operand" "v")))]
752 [(set_attr "type" "veccmp")])
754 (define_insn "altivec_vmhaddshs"
755 [(set (match_operand:V8HI 0 "register_operand" "=v")
756 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
757 (match_operand:V8HI 2 "register_operand" "v")
758 (match_operand:V8HI 3 "register_operand" "v")]
760 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
762 "vmhaddshs %0,%1,%2,%3"
763 [(set_attr "type" "veccomplex")])
765 (define_insn "altivec_vmhraddshs"
766 [(set (match_operand:V8HI 0 "register_operand" "=v")
767 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
768 (match_operand:V8HI 2 "register_operand" "v")
769 (match_operand:V8HI 3 "register_operand" "v")]
771 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
773 "vmhraddshs %0,%1,%2,%3"
774 [(set_attr "type" "veccomplex")])
776 (define_insn "altivec_vmladduhm"
777 [(set (match_operand:V8HI 0 "register_operand" "=v")
778 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
779 (match_operand:V8HI 2 "register_operand" "v")
780 (match_operand:V8HI 3 "register_operand" "v")]
783 "vmladduhm %0,%1,%2,%3"
784 [(set_attr "type" "veccomplex")])
786 (define_insn "altivec_vmrghb"
787 [(set (match_operand:V16QI 0 "register_operand" "=v")
788 (vec_merge:V16QI (vec_select:V16QI (match_operand:V16QI 1 "register_operand" "v")
789 (parallel [(const_int 0)
805 (vec_select:V16QI (match_operand:V16QI 2 "register_operand" "v")
806 (parallel [(const_int 8)
825 [(set_attr "type" "vecperm")])
827 (define_insn "altivec_vmrghh"
828 [(set (match_operand:V8HI 0 "register_operand" "=v")
829 (vec_merge:V8HI (vec_select:V8HI (match_operand:V8HI 1 "register_operand" "v")
830 (parallel [(const_int 0)
838 (vec_select:V8HI (match_operand:V8HI 2 "register_operand" "v")
839 (parallel [(const_int 4)
850 [(set_attr "type" "vecperm")])
852 (define_insn "altivec_vmrghw"
853 [(set (match_operand:V4SI 0 "register_operand" "=v")
854 (vec_merge:V4SI (vec_select:V4SI (match_operand:V4SI 1 "register_operand" "v")
855 (parallel [(const_int 0)
859 (vec_select:V4SI (match_operand:V4SI 2 "register_operand" "v")
860 (parallel [(const_int 2)
867 [(set_attr "type" "vecperm")])
869 (define_insn "altivec_vmrghsf"
870 [(set (match_operand:V4SF 0 "register_operand" "=v")
871 (vec_merge:V4SF (vec_select:V4SF (match_operand:V4SF 1 "register_operand" "v")
872 (parallel [(const_int 0)
876 (vec_select:V4SF (match_operand:V4SF 2 "register_operand" "v")
877 (parallel [(const_int 2)
884 [(set_attr "type" "vecperm")])
886 (define_insn "altivec_vmrglb"
887 [(set (match_operand:V16QI 0 "register_operand" "=v")
888 (vec_merge:V16QI (vec_select:V16QI (match_operand:V16QI 1 "register_operand" "v")
889 (parallel [(const_int 8)
905 (vec_select:V16QI (match_operand:V16QI 2 "register_operand" "v")
906 (parallel [(const_int 0)
925 [(set_attr "type" "vecperm")])
927 (define_insn "altivec_vmrglh"
928 [(set (match_operand:V8HI 0 "register_operand" "=v")
929 (vec_merge:V8HI (vec_select:V8HI (match_operand:V8HI 1 "register_operand" "v")
930 (parallel [(const_int 4)
938 (vec_select:V8HI (match_operand:V8HI 2 "register_operand" "v")
939 (parallel [(const_int 0)
950 [(set_attr "type" "vecperm")])
952 (define_insn "altivec_vmrglw"
953 [(set (match_operand:V4SI 0 "register_operand" "=v")
954 (vec_merge:V4SI (vec_select:V4SI (match_operand:V4SI 1 "register_operand" "v")
955 (parallel [(const_int 2)
959 (vec_select:V4SI (match_operand:V4SI 2 "register_operand" "v")
960 (parallel [(const_int 0)
967 [(set_attr "type" "vecperm")])
969 (define_insn "altivec_vmrglsf"
970 [(set (match_operand:V4SF 0 "register_operand" "=v")
971 (vec_merge:V4SF (vec_select:V4SF (match_operand:V4SF 1 "register_operand" "v")
972 (parallel [(const_int 2)
976 (vec_select:V4SF (match_operand:V4SF 2 "register_operand" "v")
977 (parallel [(const_int 0)
984 [(set_attr "type" "vecperm")])
986 (define_insn "altivec_vmuleub"
987 [(set (match_operand:V8HI 0 "register_operand" "=v")
988 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
989 (match_operand:V16QI 2 "register_operand" "v")]
993 [(set_attr "type" "veccomplex")])
995 (define_insn "altivec_vmulesb"
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_vmuleuh"
1005 [(set (match_operand:V4SI 0 "register_operand" "=v")
1006 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
1007 (match_operand:V8HI 2 "register_operand" "v")]
1011 [(set_attr "type" "veccomplex")])
1013 (define_insn "altivec_vmulesh"
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_vmuloub"
1023 [(set (match_operand:V8HI 0 "register_operand" "=v")
1024 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
1025 (match_operand:V16QI 2 "register_operand" "v")]
1029 [(set_attr "type" "veccomplex")])
1031 (define_insn "altivec_vmulosb"
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_vmulouh"
1041 [(set (match_operand:V4SI 0 "register_operand" "=v")
1042 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
1043 (match_operand:V8HI 2 "register_operand" "v")]
1047 [(set_attr "type" "veccomplex")])
1049 (define_insn "altivec_vmulosh"
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")])
1061 (define_insn "and<mode>3"
1062 [(set (match_operand:VI 0 "register_operand" "=v")
1063 (and:VI (match_operand:VI 1 "register_operand" "v")
1064 (match_operand:VI 2 "register_operand" "v")))]
1067 [(set_attr "type" "vecsimple")])
1069 (define_insn "ior<mode>3"
1070 [(set (match_operand:VI 0 "register_operand" "=v")
1071 (ior:VI (match_operand:VI 1 "register_operand" "v")
1072 (match_operand:VI 2 "register_operand" "v")))]
1075 [(set_attr "type" "vecsimple")])
1077 (define_insn "xor<mode>3"
1078 [(set (match_operand:VI 0 "register_operand" "=v")
1079 (xor:VI (match_operand:VI 1 "register_operand" "v")
1080 (match_operand:VI 2 "register_operand" "v")))]
1083 [(set_attr "type" "vecsimple")])
1085 (define_insn "xorv4sf3"
1086 [(set (match_operand:V4SF 0 "register_operand" "=v")
1087 (xor:V4SF (match_operand:V4SF 1 "register_operand" "v")
1088 (match_operand:V4SF 2 "register_operand" "v")))]
1091 [(set_attr "type" "vecsimple")])
1093 (define_insn "one_cmpl<mode>2"
1094 [(set (match_operand:VI 0 "register_operand" "=v")
1095 (not:VI (match_operand:VI 1 "register_operand" "v")))]
1098 [(set_attr "type" "vecsimple")])
1100 (define_insn "altivec_nor<mode>3"
1101 [(set (match_operand:VI 0 "register_operand" "=v")
1102 (not:VI (ior:VI (match_operand:VI 1 "register_operand" "v")
1103 (match_operand:VI 2 "register_operand" "v"))))]
1106 [(set_attr "type" "vecsimple")])
1108 (define_insn "andc<mode>3"
1109 [(set (match_operand:VI 0 "register_operand" "=v")
1110 (and:VI (not:VI (match_operand:VI 2 "register_operand" "v"))
1111 (match_operand:VI 1 "register_operand" "v")))]
1114 [(set_attr "type" "vecsimple")])
1116 (define_insn "*andc3_v4sf"
1117 [(set (match_operand:V4SF 0 "register_operand" "=v")
1118 (and:V4SF (not:V4SF (match_operand:V4SF 2 "register_operand" "v"))
1119 (match_operand:V4SF 1 "register_operand" "v")))]
1122 [(set_attr "type" "vecsimple")])
1124 (define_insn "altivec_vpkuhum"
1125 [(set (match_operand:V16QI 0 "register_operand" "=v")
1126 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
1127 (match_operand:V8HI 2 "register_operand" "v")]
1131 [(set_attr "type" "vecperm")])
1133 (define_insn "altivec_vpkuwum"
1134 [(set (match_operand:V8HI 0 "register_operand" "=v")
1135 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
1136 (match_operand:V4SI 2 "register_operand" "v")]
1140 [(set_attr "type" "vecperm")])
1142 (define_insn "altivec_vpkpx"
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_vpkshss"
1152 [(set (match_operand:V16QI 0 "register_operand" "=v")
1153 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
1154 (match_operand:V8HI 2 "register_operand" "v")]
1156 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1159 [(set_attr "type" "vecperm")])
1161 (define_insn "altivec_vpkswss"
1162 [(set (match_operand:V8HI 0 "register_operand" "=v")
1163 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
1164 (match_operand:V4SI 2 "register_operand" "v")]
1166 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1169 [(set_attr "type" "vecperm")])
1171 (define_insn "altivec_vpkuhus"
1172 [(set (match_operand:V16QI 0 "register_operand" "=v")
1173 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
1174 (match_operand:V8HI 2 "register_operand" "v")]
1176 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1179 [(set_attr "type" "vecperm")])
1181 (define_insn "altivec_vpkshus"
1182 [(set (match_operand:V16QI 0 "register_operand" "=v")
1183 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
1184 (match_operand:V8HI 2 "register_operand" "v")]
1186 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1189 [(set_attr "type" "vecperm")])
1191 (define_insn "altivec_vpkuwus"
1192 [(set (match_operand:V8HI 0 "register_operand" "=v")
1193 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
1194 (match_operand:V4SI 2 "register_operand" "v")]
1196 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1199 [(set_attr "type" "vecperm")])
1201 (define_insn "altivec_vpkswus"
1202 [(set (match_operand:V8HI 0 "register_operand" "=v")
1203 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
1204 (match_operand:V4SI 2 "register_operand" "v")]
1206 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1209 [(set_attr "type" "vecperm")])
1211 (define_insn "altivec_vrl<VI_char>"
1212 [(set (match_operand:VI 0 "register_operand" "=v")
1213 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
1214 (match_operand:VI 2 "register_operand" "v")]
1217 "vrl<VI_char> %0,%1,%2"
1218 [(set_attr "type" "vecsimple")])
1220 (define_insn "altivec_vsl<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 "vsl<VI_char> %0,%1,%2"
1227 [(set_attr "type" "vecsimple")])
1229 (define_insn "altivec_vsl"
1230 [(set (match_operand:V4SI 0 "register_operand" "=v")
1231 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1232 (match_operand:V4SI 2 "register_operand" "v")]
1236 [(set_attr "type" "vecperm")])
1238 (define_insn "altivec_vslo"
1239 [(set (match_operand:V4SI 0 "register_operand" "=v")
1240 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1241 (match_operand:V4SI 2 "register_operand" "v")]
1245 [(set_attr "type" "vecperm")])
1247 (define_insn "lshr<mode>3"
1248 [(set (match_operand:VI 0 "register_operand" "=v")
1249 (lshiftrt:VI (match_operand:VI 1 "register_operand" "v")
1250 (match_operand:VI 2 "register_operand" "v") ))]
1252 "vsr<VI_char> %0,%1,%2"
1253 [(set_attr "type" "vecsimple")])
1255 (define_insn "ashr<mode>3"
1256 [(set (match_operand:VI 0 "register_operand" "=v")
1257 (ashiftrt:VI (match_operand:VI 1 "register_operand" "v")
1258 (match_operand:VI 2 "register_operand" "v") ))]
1260 "vsra<VI_char> %0,%1,%2"
1261 [(set_attr "type" "vecsimple")])
1263 (define_insn "altivec_vsr"
1264 [(set (match_operand:V4SI 0 "register_operand" "=v")
1265 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1266 (match_operand:V4SI 2 "register_operand" "v")]
1270 [(set_attr "type" "vecperm")])
1272 (define_insn "altivec_vsro"
1273 [(set (match_operand:V4SI 0 "register_operand" "=v")
1274 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1275 (match_operand:V4SI 2 "register_operand" "v")]
1279 [(set_attr "type" "vecperm")])
1281 (define_insn "altivec_vsum4ubs"
1282 [(set (match_operand:V4SI 0 "register_operand" "=v")
1283 (unspec:V4SI [(match_operand:V16QI 1 "register_operand" "v")
1284 (match_operand:V4SI 2 "register_operand" "v")]
1286 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1289 [(set_attr "type" "veccomplex")])
1291 (define_insn "altivec_vsum4s<VI_char>s"
1292 [(set (match_operand:V4SI 0 "register_operand" "=v")
1293 (unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v")
1294 (match_operand:V4SI 2 "register_operand" "v")]
1296 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1298 "vsum4s<VI_char>s %0,%1,%2"
1299 [(set_attr "type" "veccomplex")])
1301 (define_insn "altivec_vsum2sws"
1302 [(set (match_operand:V4SI 0 "register_operand" "=v")
1303 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1304 (match_operand:V4SI 2 "register_operand" "v")]
1306 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1309 [(set_attr "type" "veccomplex")])
1311 (define_insn "altivec_vsumsws"
1312 [(set (match_operand:V4SI 0 "register_operand" "=v")
1313 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1314 (match_operand:V4SI 2 "register_operand" "v")]
1316 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1319 [(set_attr "type" "veccomplex")])
1321 (define_insn "altivec_vspltb"
1322 [(set (match_operand:V16QI 0 "register_operand" "=v")
1323 (vec_duplicate:V16QI
1324 (vec_select:QI (match_operand:V16QI 1 "register_operand" "v")
1326 [(match_operand:QI 2 "u5bit_cint_operand" "")]))))]
1329 [(set_attr "type" "vecperm")])
1331 (define_insn "altivec_vsplth"
1332 [(set (match_operand:V8HI 0 "register_operand" "=v")
1334 (vec_select:HI (match_operand:V8HI 1 "register_operand" "v")
1336 [(match_operand:QI 2 "u5bit_cint_operand" "")]))))]
1339 [(set_attr "type" "vecperm")])
1341 (define_insn "altivec_vspltw"
1342 [(set (match_operand:V4SI 0 "register_operand" "=v")
1344 (vec_select:SI (match_operand:V4SI 1 "register_operand" "v")
1346 [(match_operand:QI 2 "u5bit_cint_operand" "i")]))))]
1349 [(set_attr "type" "vecperm")])
1351 (define_insn "*altivec_vspltsf"
1352 [(set (match_operand:V4SF 0 "register_operand" "=v")
1354 (vec_select:SF (match_operand:V4SF 1 "register_operand" "v")
1356 [(match_operand:QI 2 "u5bit_cint_operand" "i")]))))]
1359 [(set_attr "type" "vecperm")])
1361 (define_insn "altivec_vspltis<VI_char>"
1362 [(set (match_operand:VI 0 "register_operand" "=v")
1364 (match_operand:QI 1 "s5bit_cint_operand" "i")))]
1366 "vspltis<VI_char> %0,%1"
1367 [(set_attr "type" "vecperm")])
1369 (define_insn "ftruncv4sf2"
1370 [(set (match_operand:V4SF 0 "register_operand" "=v")
1371 (fix:V4SF (match_operand:V4SF 1 "register_operand" "v")))]
1374 [(set_attr "type" "vecfloat")])
1376 (define_insn "altivec_vperm_<mode>"
1377 [(set (match_operand:V 0 "register_operand" "=v")
1378 (unspec:V [(match_operand:V 1 "register_operand" "v")
1379 (match_operand:V 2 "register_operand" "v")
1380 (match_operand:V16QI 3 "register_operand" "v")]
1384 [(set_attr "type" "vecperm")])
1386 (define_insn "altivec_vrfip"
1387 [(set (match_operand:V4SF 0 "register_operand" "=v")
1388 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1392 [(set_attr "type" "vecfloat")])
1394 (define_insn "altivec_vrfin"
1395 [(set (match_operand:V4SF 0 "register_operand" "=v")
1396 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1400 [(set_attr "type" "vecfloat")])
1402 (define_insn "altivec_vrfim"
1403 [(set (match_operand:V4SF 0 "register_operand" "=v")
1404 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1408 [(set_attr "type" "vecfloat")])
1410 (define_insn "altivec_vcfux"
1411 [(set (match_operand:V4SF 0 "register_operand" "=v")
1412 (unspec:V4SF [(match_operand:V4SI 1 "register_operand" "v")
1413 (match_operand:QI 2 "immediate_operand" "i")]
1417 [(set_attr "type" "vecfloat")])
1419 (define_insn "altivec_vcfsx"
1420 [(set (match_operand:V4SF 0 "register_operand" "=v")
1421 (unspec:V4SF [(match_operand:V4SI 1 "register_operand" "v")
1422 (match_operand:QI 2 "immediate_operand" "i")]
1426 [(set_attr "type" "vecfloat")])
1428 (define_insn "altivec_vctuxs"
1429 [(set (match_operand:V4SI 0 "register_operand" "=v")
1430 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
1431 (match_operand:QI 2 "immediate_operand" "i")]
1433 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1436 [(set_attr "type" "vecfloat")])
1438 (define_insn "altivec_vctsxs"
1439 [(set (match_operand:V4SI 0 "register_operand" "=v")
1440 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
1441 (match_operand:QI 2 "immediate_operand" "i")]
1443 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1446 [(set_attr "type" "vecfloat")])
1448 (define_insn "altivec_vlogefp"
1449 [(set (match_operand:V4SF 0 "register_operand" "=v")
1450 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1454 [(set_attr "type" "vecfloat")])
1456 (define_insn "altivec_vexptefp"
1457 [(set (match_operand:V4SF 0 "register_operand" "=v")
1458 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1462 [(set_attr "type" "vecfloat")])
1464 (define_insn "altivec_vrsqrtefp"
1465 [(set (match_operand:V4SF 0 "register_operand" "=v")
1466 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1470 [(set_attr "type" "vecfloat")])
1472 (define_insn "altivec_vrefp"
1473 [(set (match_operand:V4SF 0 "register_operand" "=v")
1474 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1478 [(set_attr "type" "vecfloat")])
1480 (define_expand "vcondv4si"
1481 [(set (match_operand:V4SI 0 "register_operand" "=v")
1483 (match_operator 3 "comparison_operator"
1484 [(match_operand:V4SI 4 "register_operand" "v")
1485 (match_operand:V4SI 5 "register_operand" "v")])
1486 (match_operand:V4SI 1 "register_operand" "v")
1487 (match_operand:V4SI 2 "register_operand" "v")))]
1491 if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
1492 operands[3], operands[4], operands[5]))
1499 (define_expand "vconduv4si"
1500 [(set (match_operand:V4SI 0 "register_operand" "=v")
1502 (match_operator 3 "comparison_operator"
1503 [(match_operand:V4SI 4 "register_operand" "v")
1504 (match_operand:V4SI 5 "register_operand" "v")])
1505 (match_operand:V4SI 1 "register_operand" "v")
1506 (match_operand:V4SI 2 "register_operand" "v")))]
1510 if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
1511 operands[3], operands[4], operands[5]))
1518 (define_expand "vcondv4sf"
1519 [(set (match_operand:V4SF 0 "register_operand" "=v")
1521 (match_operator 3 "comparison_operator"
1522 [(match_operand:V4SF 4 "register_operand" "v")
1523 (match_operand:V4SF 5 "register_operand" "v")])
1524 (match_operand:V4SF 1 "register_operand" "v")
1525 (match_operand:V4SF 2 "register_operand" "v")))]
1529 if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
1530 operands[3], operands[4], operands[5]))
1537 (define_expand "vcondv8hi"
1538 [(set (match_operand:V8HI 0 "register_operand" "=v")
1540 (match_operator 3 "comparison_operator"
1541 [(match_operand:V8HI 4 "register_operand" "v")
1542 (match_operand:V8HI 5 "register_operand" "v")])
1543 (match_operand:V8HI 1 "register_operand" "v")
1544 (match_operand:V8HI 2 "register_operand" "v")))]
1548 if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
1549 operands[3], operands[4], operands[5]))
1556 (define_expand "vconduv8hi"
1557 [(set (match_operand:V8HI 0 "register_operand" "=v")
1559 (match_operator 3 "comparison_operator"
1560 [(match_operand:V8HI 4 "register_operand" "v")
1561 (match_operand:V8HI 5 "register_operand" "v")])
1562 (match_operand:V8HI 1 "register_operand" "v")
1563 (match_operand:V8HI 2 "register_operand" "v")))]
1567 if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
1568 operands[3], operands[4], operands[5]))
1575 (define_expand "vcondv16qi"
1576 [(set (match_operand:V16QI 0 "register_operand" "=v")
1578 (match_operator 3 "comparison_operator"
1579 [(match_operand:V16QI 4 "register_operand" "v")
1580 (match_operand:V16QI 5 "register_operand" "v")])
1581 (match_operand:V16QI 1 "register_operand" "v")
1582 (match_operand:V16QI 2 "register_operand" "v")))]
1586 if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
1587 operands[3], operands[4], operands[5]))
1594 (define_expand "vconduv16qi"
1595 [(set (match_operand:V16QI 0 "register_operand" "=v")
1597 (match_operator 3 "comparison_operator"
1598 [(match_operand:V16QI 4 "register_operand" "v")
1599 (match_operand:V16QI 5 "register_operand" "v")])
1600 (match_operand:V16QI 1 "register_operand" "v")
1601 (match_operand:V16QI 2 "register_operand" "v")))]
1605 if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
1606 operands[3], operands[4], operands[5]))
1614 (define_insn "altivec_vsel_v4si"
1615 [(set (match_operand:V4SI 0 "register_operand" "=v")
1616 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1617 (match_operand:V4SI 2 "register_operand" "v")
1618 (match_operand:V4SI 3 "register_operand" "v")]
1622 [(set_attr "type" "vecperm")])
1624 (define_insn "altivec_vsel_v4sf"
1625 [(set (match_operand:V4SF 0 "register_operand" "=v")
1626 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")
1627 (match_operand:V4SF 2 "register_operand" "v")
1628 (match_operand:V4SI 3 "register_operand" "v")]
1632 [(set_attr "type" "vecperm")])
1634 (define_insn "altivec_vsel_v8hi"
1635 [(set (match_operand:V8HI 0 "register_operand" "=v")
1636 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
1637 (match_operand:V8HI 2 "register_operand" "v")
1638 (match_operand:V8HI 3 "register_operand" "v")]
1642 [(set_attr "type" "vecperm")])
1644 (define_insn "altivec_vsel_v16qi"
1645 [(set (match_operand:V16QI 0 "register_operand" "=v")
1646 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
1647 (match_operand:V16QI 2 "register_operand" "v")
1648 (match_operand:V16QI 3 "register_operand" "v")]
1652 [(set_attr "type" "vecperm")])
1654 (define_insn "altivec_vsldoi_<mode>"
1655 [(set (match_operand:V 0 "register_operand" "=v")
1656 (unspec:V [(match_operand:V 1 "register_operand" "v")
1657 (match_operand:V 2 "register_operand" "v")
1658 (match_operand:QI 3 "immediate_operand" "i")]
1661 "vsldoi %0,%1,%2,%3"
1662 [(set_attr "type" "vecperm")])
1664 (define_insn "altivec_vupkhsb"
1665 [(set (match_operand:V8HI 0 "register_operand" "=v")
1666 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
1670 [(set_attr "type" "vecperm")])
1672 (define_insn "altivec_vupkhpx"
1673 [(set (match_operand:V4SI 0 "register_operand" "=v")
1674 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
1678 [(set_attr "type" "vecperm")])
1680 (define_insn "altivec_vupkhsh"
1681 [(set (match_operand:V4SI 0 "register_operand" "=v")
1682 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
1686 [(set_attr "type" "vecperm")])
1688 (define_insn "altivec_vupklsb"
1689 [(set (match_operand:V8HI 0 "register_operand" "=v")
1690 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
1694 [(set_attr "type" "vecperm")])
1696 (define_insn "altivec_vupklpx"
1697 [(set (match_operand:V4SI 0 "register_operand" "=v")
1698 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
1702 [(set_attr "type" "vecperm")])
1704 (define_insn "altivec_vupklsh"
1705 [(set (match_operand:V4SI 0 "register_operand" "=v")
1706 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
1710 [(set_attr "type" "vecperm")])
1712 ;; AltiVec predicates.
1714 (define_expand "cr6_test_for_zero"
1715 [(set (match_operand:SI 0 "register_operand" "=r")
1721 (define_expand "cr6_test_for_zero_reverse"
1722 [(set (match_operand:SI 0 "register_operand" "=r")
1725 (set (match_dup 0) (minus:SI (const_int 1) (match_dup 0)))]
1729 (define_expand "cr6_test_for_lt"
1730 [(set (match_operand:SI 0 "register_operand" "=r")
1736 (define_expand "cr6_test_for_lt_reverse"
1737 [(set (match_operand:SI 0 "register_operand" "=r")
1740 (set (match_dup 0) (minus:SI (const_int 1) (match_dup 0)))]
1744 ;; We can get away with generating the opcode on the fly (%3 below)
1745 ;; because all the predicates have the same scheduling parameters.
1747 (define_insn "altivec_predicate_<mode>"
1749 (unspec:CC [(match_operand:V 1 "register_operand" "v")
1750 (match_operand:V 2 "register_operand" "v")
1751 (match_operand 3 "any_operand" "")] UNSPEC_PREDICATE))
1752 (clobber (match_scratch:V 0 "=v"))]
1755 [(set_attr "type" "veccmp")])
1757 (define_insn "altivec_mtvscr"
1760 [(match_operand:V4SI 0 "register_operand" "v")] UNSPECV_MTVSCR))]
1763 [(set_attr "type" "vecsimple")])
1765 (define_insn "altivec_mfvscr"
1766 [(set (match_operand:V8HI 0 "register_operand" "=v")
1767 (unspec_volatile:V8HI [(reg:SI 110)] UNSPECV_MFVSCR))]
1770 [(set_attr "type" "vecsimple")])
1772 (define_insn "altivec_dssall"
1773 [(unspec_volatile [(const_int 0)] UNSPECV_DSSALL)]
1776 [(set_attr "type" "vecsimple")])
1778 (define_insn "altivec_dss"
1779 [(unspec_volatile [(match_operand:QI 0 "immediate_operand" "i")]
1783 [(set_attr "type" "vecsimple")])
1785 (define_insn "altivec_dst"
1786 [(unspec [(match_operand 0 "register_operand" "b")
1787 (match_operand:SI 1 "register_operand" "r")
1788 (match_operand:QI 2 "immediate_operand" "i")] UNSPEC_DST)]
1789 "TARGET_ALTIVEC && GET_MODE (operands[0]) == Pmode"
1791 [(set_attr "type" "vecsimple")])
1793 (define_insn "altivec_dstt"
1794 [(unspec [(match_operand 0 "register_operand" "b")
1795 (match_operand:SI 1 "register_operand" "r")
1796 (match_operand:QI 2 "immediate_operand" "i")] UNSPEC_DSTT)]
1797 "TARGET_ALTIVEC && GET_MODE (operands[0]) == Pmode"
1799 [(set_attr "type" "vecsimple")])
1801 (define_insn "altivec_dstst"
1802 [(unspec [(match_operand 0 "register_operand" "b")
1803 (match_operand:SI 1 "register_operand" "r")
1804 (match_operand:QI 2 "immediate_operand" "i")] UNSPEC_DSTST)]
1805 "TARGET_ALTIVEC && GET_MODE (operands[0]) == Pmode"
1807 [(set_attr "type" "vecsimple")])
1809 (define_insn "altivec_dststt"
1810 [(unspec [(match_operand 0 "register_operand" "b")
1811 (match_operand:SI 1 "register_operand" "r")
1812 (match_operand:QI 2 "immediate_operand" "i")] UNSPEC_DSTSTT)]
1813 "TARGET_ALTIVEC && GET_MODE (operands[0]) == Pmode"
1815 [(set_attr "type" "vecsimple")])
1817 (define_insn "altivec_lvsl"
1818 [(set (match_operand:V16QI 0 "register_operand" "=v")
1819 (unspec:V16QI [(match_operand 1 "memory_operand" "Z")] UNSPEC_LVSL))]
1822 [(set_attr "type" "vecload")])
1824 (define_insn "altivec_lvsr"
1825 [(set (match_operand:V16QI 0 "register_operand" "=v")
1826 (unspec:V16QI [(match_operand 1 "memory_operand" "Z")] UNSPEC_LVSR))]
1829 [(set_attr "type" "vecload")])
1831 (define_expand "build_vector_mask_for_load"
1832 [(set (match_operand:V16QI 0 "register_operand" "")
1833 (unspec:V16QI [(match_operand 1 "memory_operand" "")] UNSPEC_LVSR))]
1840 gcc_assert (GET_CODE (operands[1]) == MEM);
1842 addr = XEXP (operands[1], 0);
1843 temp = gen_reg_rtx (GET_MODE (addr));
1844 emit_insn (gen_rtx_SET (VOIDmode, temp,
1845 gen_rtx_NEG (GET_MODE (addr), addr)));
1846 emit_insn (gen_altivec_lvsr (operands[0],
1847 replace_equiv_address (operands[1], temp)));
1851 ;; Parallel some of the LVE* and STV*'s with unspecs because some have
1852 ;; identical rtl but different instructions-- and gcc gets confused.
1854 (define_insn "altivec_lve<VI_char>x"
1856 [(set (match_operand:VI 0 "register_operand" "=v")
1857 (match_operand:VI 1 "memory_operand" "Z"))
1858 (unspec [(const_int 0)] UNSPEC_LVE)])]
1860 "lve<VI_char>x %0,%y1"
1861 [(set_attr "type" "vecload")])
1863 (define_insn "*altivec_lvesfx"
1865 [(set (match_operand:V4SF 0 "register_operand" "=v")
1866 (match_operand:V4SF 1 "memory_operand" "Z"))
1867 (unspec [(const_int 0)] UNSPEC_LVE)])]
1870 [(set_attr "type" "vecload")])
1872 (define_insn "altivec_lvxl"
1874 [(set (match_operand:V4SI 0 "register_operand" "=v")
1875 (match_operand:V4SI 1 "memory_operand" "Z"))
1876 (unspec [(const_int 0)] UNSPEC_SET_VSCR)])]
1879 [(set_attr "type" "vecload")])
1881 (define_insn "altivec_lvx"
1882 [(set (match_operand:V4SI 0 "register_operand" "=v")
1883 (match_operand:V4SI 1 "memory_operand" "Z"))]
1886 [(set_attr "type" "vecload")])
1888 (define_insn "altivec_stvx"
1890 [(set (match_operand:V4SI 0 "memory_operand" "=Z")
1891 (match_operand:V4SI 1 "register_operand" "v"))
1892 (unspec [(const_int 0)] UNSPEC_STVX)])]
1895 [(set_attr "type" "vecstore")])
1897 (define_insn "altivec_stvxl"
1899 [(set (match_operand:V4SI 0 "memory_operand" "=Z")
1900 (match_operand:V4SI 1 "register_operand" "v"))
1901 (unspec [(const_int 0)] UNSPEC_STVXL)])]
1904 [(set_attr "type" "vecstore")])
1906 (define_insn "altivec_stve<VI_char>x"
1908 [(set (match_operand:VI 0 "memory_operand" "=Z")
1909 (match_operand:VI 1 "register_operand" "v"))
1910 (unspec [(const_int 0)] UNSPEC_STVE)])]
1912 "stve<VI_char>x %1,%y0"
1913 [(set_attr "type" "vecstore")])
1915 (define_insn "*altivec_stvesfx"
1917 [(set (match_operand:V4SF 0 "memory_operand" "=Z")
1918 (match_operand:V4SF 1 "register_operand" "v"))
1919 (unspec [(const_int 0)] UNSPEC_STVE)])]
1922 [(set_attr "type" "vecstore")])
1924 (define_expand "vec_init<mode>"
1925 [(match_operand:V 0 "register_operand" "")
1926 (match_operand 1 "" "")]
1929 rs6000_expand_vector_init (operands[0], operands[1]);
1933 (define_expand "vec_setv4si"
1934 [(match_operand:V4SI 0 "register_operand" "")
1935 (match_operand:SI 1 "register_operand" "")
1936 (match_operand 2 "const_int_operand" "")]
1939 rs6000_expand_vector_set (operands[0], operands[1], INTVAL (operands[2]));
1943 (define_expand "vec_setv8hi"
1944 [(match_operand:V8HI 0 "register_operand" "")
1945 (match_operand:HI 1 "register_operand" "")
1946 (match_operand 2 "const_int_operand" "")]
1949 rs6000_expand_vector_set (operands[0], operands[1], INTVAL (operands[2]));
1953 (define_expand "vec_setv16qi"
1954 [(match_operand:V16QI 0 "register_operand" "")
1955 (match_operand:QI 1 "register_operand" "")
1956 (match_operand 2 "const_int_operand" "")]
1959 rs6000_expand_vector_set (operands[0], operands[1], INTVAL (operands[2]));
1963 (define_expand "vec_setv4sf"
1964 [(match_operand:V4SF 0 "register_operand" "")
1965 (match_operand:SF 1 "register_operand" "")
1966 (match_operand 2 "const_int_operand" "")]
1969 rs6000_expand_vector_set (operands[0], operands[1], INTVAL (operands[2]));
1973 (define_expand "vec_extractv4si"
1974 [(match_operand:SI 0 "register_operand" "")
1975 (match_operand:V4SI 1 "register_operand" "")
1976 (match_operand 2 "const_int_operand" "")]
1979 rs6000_expand_vector_extract (operands[0], operands[1], INTVAL (operands[2]));
1983 (define_expand "vec_extractv8hi"
1984 [(match_operand:HI 0 "register_operand" "")
1985 (match_operand:V8HI 1 "register_operand" "")
1986 (match_operand 2 "const_int_operand" "")]
1989 rs6000_expand_vector_extract (operands[0], operands[1], INTVAL (operands[2]));
1993 (define_expand "vec_extractv16qi"
1994 [(match_operand:QI 0 "register_operand" "")
1995 (match_operand:V16QI 1 "register_operand" "")
1996 (match_operand 2 "const_int_operand" "")]
1999 rs6000_expand_vector_extract (operands[0], operands[1], INTVAL (operands[2]));
2003 (define_expand "vec_extractv4sf"
2004 [(match_operand:SF 0 "register_operand" "")
2005 (match_operand:V4SF 1 "register_operand" "")
2006 (match_operand 2 "const_int_operand" "")]
2009 rs6000_expand_vector_extract (operands[0], operands[1], INTVAL (operands[2]));
2014 ;; vspltis? SCRATCH0,0
2015 ;; vsubu?m SCRATCH2,SCRATCH1,%1
2016 ;; vmaxs? %0,%1,SCRATCH2"
2017 (define_expand "abs<mode>2"
2018 [(set (match_dup 2) (vec_duplicate:VI (const_int 0)))
2020 (minus:VI (match_dup 2)
2021 (match_operand:VI 1 "register_operand" "v")))
2022 (set (match_operand:VI 0 "register_operand" "=v")
2023 (smax:VI (match_dup 1) (match_dup 3)))]
2026 operands[2] = gen_reg_rtx (GET_MODE (operands[0]));
2027 operands[3] = gen_reg_rtx (GET_MODE (operands[0]));
2031 ;; vspltisw SCRATCH1,-1
2032 ;; vslw SCRATCH2,SCRATCH1,SCRATCH1
2033 ;; vandc %0,%1,SCRATCH2
2034 (define_expand "absv4sf2"
2036 (vec_duplicate:V4SI (const_int -1)))
2038 (unspec:V4SI [(match_dup 2) (match_dup 2)] UNSPEC_VSL))
2039 (set (match_operand:V4SF 0 "register_operand" "=v")
2040 (and:V4SF (not:V4SF (subreg:V4SF (match_dup 3) 0))
2041 (match_operand:V4SF 1 "register_operand" "v")))]
2044 operands[2] = gen_reg_rtx (V4SImode);
2045 operands[3] = gen_reg_rtx (V4SImode);
2049 ;; vspltis? SCRATCH0,0
2050 ;; vsubs?s SCRATCH2,SCRATCH1,%1
2051 ;; vmaxs? %0,%1,SCRATCH2"
2052 (define_expand "altivec_abss_<mode>"
2053 [(set (match_dup 2) (vec_duplicate:VI (const_int 0)))
2054 (parallel [(set (match_dup 3)
2055 (unspec:VI [(match_dup 2)
2056 (match_operand:VI 1 "register_operand" "v")]
2058 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))])
2059 (set (match_operand:VI 0 "register_operand" "=v")
2060 (smax:VI (match_dup 1) (match_dup 3)))]
2063 operands[2] = gen_reg_rtx (GET_MODE (operands[0]));
2064 operands[3] = gen_reg_rtx (GET_MODE (operands[0]));
2067 ;; Vector shift left in bits. Currently supported ony for shift
2068 ;; amounts that can be expressed as byte shifts (divisible by 8).
2069 ;; General shift amounts can be supported using vslo + vsl. We're
2070 ;; not expecting to see these yet (the vectorizer currently
2071 ;; generates only shifts divisible by byte_size).
2072 (define_expand "vec_shl_<mode>"
2073 [(set (match_operand:V 0 "register_operand" "=v")
2074 (unspec:V [(match_operand:V 1 "register_operand" "v")
2075 (match_operand:QI 2 "reg_or_short_operand" "")]
2080 rtx bitshift = operands[2];
2081 rtx byteshift = gen_reg_rtx (QImode);
2082 HOST_WIDE_INT bitshift_val;
2083 HOST_WIDE_INT byteshift_val;
2085 if (! CONSTANT_P (bitshift))
2087 bitshift_val = INTVAL (bitshift);
2088 if (bitshift_val & 0x7)
2090 byteshift_val = bitshift_val >> 3;
2091 byteshift = gen_rtx_CONST_INT (QImode, byteshift_val);
2092 emit_insn (gen_altivec_vsldoi_<mode> (operands[0], operands[1], operands[1],
2097 ;; Vector shift left in bits. Currently supported ony for shift
2098 ;; amounts that can be expressed as byte shifts (divisible by 8).
2099 ;; General shift amounts can be supported using vsro + vsr. We're
2100 ;; not expecting to see these yet (the vectorizer currently
2101 ;; generates only shifts divisible by byte_size).
2102 (define_expand "vec_shr_<mode>"
2103 [(set (match_operand:V 0 "register_operand" "=v")
2104 (unspec:V [(match_operand:V 1 "register_operand" "v")
2105 (match_operand:QI 2 "reg_or_short_operand" "")]
2110 rtx bitshift = operands[2];
2111 rtx byteshift = gen_reg_rtx (QImode);
2112 HOST_WIDE_INT bitshift_val;
2113 HOST_WIDE_INT byteshift_val;
2115 if (! CONSTANT_P (bitshift))
2117 bitshift_val = INTVAL (bitshift);
2118 if (bitshift_val & 0x7)
2120 byteshift_val = 16 - (bitshift_val >> 3);
2121 byteshift = gen_rtx_CONST_INT (QImode, byteshift_val);
2122 emit_insn (gen_altivec_vsldoi_<mode> (operands[0], operands[1], operands[1],
2127 (define_insn "altivec_vsumsws_nomode"
2128 [(set (match_operand 0 "register_operand" "=v")
2129 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
2130 (match_operand:V4SI 2 "register_operand" "v")]
2132 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
2135 [(set_attr "type" "veccomplex")])
2137 (define_expand "reduc_splus_<mode>"
2138 [(set (match_operand:VIshort 0 "register_operand" "=v")
2139 (unspec:VIshort [(match_operand:VIshort 1 "register_operand" "v")]
2140 UNSPEC_REDUC_PLUS))]
2144 rtx vzero = gen_reg_rtx (V4SImode);
2145 rtx vtmp1 = gen_reg_rtx (V4SImode);
2147 emit_insn (gen_altivec_vspltisw (vzero, const0_rtx));
2148 emit_insn (gen_altivec_vsum4s<VI_char>s (vtmp1, operands[1], vzero));
2149 emit_insn (gen_altivec_vsumsws_nomode (operands[0], vtmp1, vzero));
2153 (define_expand "reduc_uplus_v16qi"
2154 [(set (match_operand:V16QI 0 "register_operand" "=v")
2155 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")]
2156 UNSPEC_REDUC_PLUS))]
2160 rtx vzero = gen_reg_rtx (V4SImode);
2161 rtx vtmp1 = gen_reg_rtx (V4SImode);
2163 emit_insn (gen_altivec_vspltisw (vzero, const0_rtx));
2164 emit_insn (gen_altivec_vsum4ubs (vtmp1, operands[1], vzero));
2165 emit_insn (gen_altivec_vsumsws_nomode (operands[0], vtmp1, vzero));
2169 (define_insn "vec_realign_load_<mode>"
2170 [(set (match_operand:V 0 "register_operand" "=v")
2171 (unspec:V [(match_operand:V 1 "register_operand" "v")
2172 (match_operand:V 2 "register_operand" "v")
2173 (match_operand:V16QI 3 "register_operand" "v")]
2174 UNSPEC_REALIGN_LOAD))]
2177 [(set_attr "type" "vecperm")])
2179 (define_expand "neg<mode>2"
2180 [(use (match_operand:VI 0 "register_operand" ""))
2181 (use (match_operand:VI 1 "register_operand" ""))]
2187 vzero = gen_reg_rtx (GET_MODE (operands[0]));
2188 emit_insn (gen_altivec_vspltis<VI_char> (vzero, const0_rtx));
2189 emit_insn (gen_sub<mode>3 (operands[0], vzero, operands[1]));
2194 (define_expand "udot_prod<mode>"
2195 [(set (match_operand:V4SI 0 "register_operand" "=v")
2196 (plus:V4SI (match_operand:V4SI 3 "register_operand" "v")
2197 (unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v")
2198 (match_operand:VIshort 2 "register_operand" "v")]
2203 emit_insn (gen_altivec_vmsumu<VI_char>m (operands[0], operands[1], operands[2], operands[3]));
2207 (define_expand "sdot_prodv8hi"
2208 [(set (match_operand:V4SI 0 "register_operand" "=v")
2209 (plus:V4SI (match_operand:V4SI 3 "register_operand" "v")
2210 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
2211 (match_operand:V8HI 2 "register_operand" "v")]
2216 emit_insn (gen_altivec_vmsumshm (operands[0], operands[1], operands[2], operands[3]));
2220 (define_expand "widen_usum<mode>3"
2221 [(set (match_operand:V4SI 0 "register_operand" "=v")
2222 (plus:V4SI (match_operand:V4SI 2 "register_operand" "v")
2223 (unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v")]
2228 rtx vones = gen_reg_rtx (GET_MODE (operands[1]));
2230 emit_insn (gen_altivec_vspltis<VI_char> (vones, const1_rtx));
2231 emit_insn (gen_altivec_vmsumu<VI_char>m (operands[0], operands[1], vones, operands[2]));
2235 (define_expand "widen_ssumv16qi3"
2236 [(set (match_operand:V4SI 0 "register_operand" "=v")
2237 (plus:V4SI (match_operand:V4SI 2 "register_operand" "v")
2238 (unspec:V4SI [(match_operand:V16QI 1 "register_operand" "v")]
2243 rtx vones = gen_reg_rtx (V16QImode);
2245 emit_insn (gen_altivec_vspltisb (vones, const1_rtx));
2246 emit_insn (gen_altivec_vmsummbm (operands[0], operands[1], vones, operands[2]));
2250 (define_expand "widen_ssumv8hi3"
2251 [(set (match_operand:V4SI 0 "register_operand" "=v")
2252 (plus:V4SI (match_operand:V4SI 2 "register_operand" "v")
2253 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
2258 rtx vones = gen_reg_rtx (V8HImode);
2260 emit_insn (gen_altivec_vspltish (vones, const1_rtx));
2261 emit_insn (gen_altivec_vmsumshm (operands[0], operands[1], vones, operands[2]));
2265 (define_expand "vec_unpacks_hi_v16qi"
2266 [(set (match_operand:V8HI 0 "register_operand" "=v")
2267 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
2272 emit_insn (gen_altivec_vupkhsb (operands[0], operands[1]));
2276 (define_expand "vec_unpacks_hi_v8hi"
2277 [(set (match_operand:V4SI 0 "register_operand" "=v")
2278 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
2283 emit_insn (gen_altivec_vupkhsh (operands[0], operands[1]));
2287 (define_expand "vec_unpacks_lo_v16qi"
2288 [(set (match_operand:V8HI 0 "register_operand" "=v")
2289 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
2294 emit_insn (gen_altivec_vupklsb (operands[0], operands[1]));
2298 (define_expand "vec_unpacks_lo_v8hi"
2299 [(set (match_operand:V4SI 0 "register_operand" "=v")
2300 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
2305 emit_insn (gen_altivec_vupklsh (operands[0], operands[1]));
2309 (define_insn "vperm_v8hiv4si"
2310 [(set (match_operand:V4SI 0 "register_operand" "=v")
2311 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
2312 (match_operand:V4SI 2 "register_operand" "v")
2313 (match_operand:V16QI 3 "register_operand" "v")]
2317 [(set_attr "type" "vecperm")])
2319 (define_insn "vperm_v16qiv8hi"
2320 [(set (match_operand:V8HI 0 "register_operand" "=v")
2321 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
2322 (match_operand:V8HI 2 "register_operand" "v")
2323 (match_operand:V16QI 3 "register_operand" "v")]
2327 [(set_attr "type" "vecperm")])
2330 (define_expand "vec_unpacku_hi_v16qi"
2331 [(set (match_operand:V8HI 0 "register_operand" "=v")
2332 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
2337 rtx vzero = gen_reg_rtx (V8HImode);
2338 rtx mask = gen_reg_rtx (V16QImode);
2339 rtvec v = rtvec_alloc (16);
2341 emit_insn (gen_altivec_vspltish (vzero, const0_rtx));
2343 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16);
2344 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 0);
2345 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 16);
2346 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 1);
2347 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16);
2348 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 2);
2349 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 16);
2350 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 3);
2351 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2352 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 4);
2353 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 16);
2354 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 5);
2355 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16);
2356 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 6);
2357 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 16);
2358 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 7);
2360 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2361 emit_insn (gen_vperm_v16qiv8hi (operands[0], operands[1], vzero, mask));
2365 (define_expand "vec_unpacku_hi_v8hi"
2366 [(set (match_operand:V4SI 0 "register_operand" "=v")
2367 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
2372 rtx vzero = gen_reg_rtx (V4SImode);
2373 rtx mask = gen_reg_rtx (V16QImode);
2374 rtvec v = rtvec_alloc (16);
2376 emit_insn (gen_altivec_vspltisw (vzero, const0_rtx));
2378 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16);
2379 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 17);
2380 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 0);
2381 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 1);
2382 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16);
2383 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 17);
2384 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 2);
2385 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 3);
2386 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2387 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 17);
2388 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 4);
2389 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 5);
2390 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16);
2391 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 17);
2392 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 6);
2393 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 7);
2395 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2396 emit_insn (gen_vperm_v8hiv4si (operands[0], operands[1], vzero, mask));
2400 (define_expand "vec_unpacku_lo_v16qi"
2401 [(set (match_operand:V8HI 0 "register_operand" "=v")
2402 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
2407 rtx vzero = gen_reg_rtx (V8HImode);
2408 rtx mask = gen_reg_rtx (V16QImode);
2409 rtvec v = rtvec_alloc (16);
2411 emit_insn (gen_altivec_vspltish (vzero, const0_rtx));
2413 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16);
2414 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 8);
2415 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 16);
2416 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 9);
2417 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16);
2418 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 10);
2419 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 16);
2420 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 11);
2421 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2422 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 12);
2423 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 16);
2424 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 13);
2425 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16);
2426 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 14);
2427 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 16);
2428 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 15);
2430 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2431 emit_insn (gen_vperm_v16qiv8hi (operands[0], operands[1], vzero, mask));
2435 (define_expand "vec_unpacku_lo_v8hi"
2436 [(set (match_operand:V4SI 0 "register_operand" "=v")
2437 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
2442 rtx vzero = gen_reg_rtx (V4SImode);
2443 rtx mask = gen_reg_rtx (V16QImode);
2444 rtvec v = rtvec_alloc (16);
2446 emit_insn (gen_altivec_vspltisw (vzero, const0_rtx));
2448 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16);
2449 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 17);
2450 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 8);
2451 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 9);
2452 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16);
2453 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 17);
2454 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 10);
2455 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 11);
2456 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2457 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 17);
2458 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 12);
2459 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 13);
2460 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16);
2461 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 17);
2462 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 14);
2463 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 15);
2465 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2466 emit_insn (gen_vperm_v8hiv4si (operands[0], operands[1], vzero, mask));
2470 (define_expand "vec_widen_umult_hi_v16qi"
2471 [(set (match_operand:V8HI 0 "register_operand" "=v")
2472 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
2473 (match_operand:V16QI 2 "register_operand" "v")]
2478 rtx ve = gen_reg_rtx (V8HImode);
2479 rtx vo = gen_reg_rtx (V8HImode);
2481 emit_insn (gen_altivec_vmuleub (ve, operands[1], operands[2]));
2482 emit_insn (gen_altivec_vmuloub (vo, operands[1], operands[2]));
2483 emit_insn (gen_altivec_vmrghh (operands[0], ve, vo));
2487 (define_expand "vec_widen_umult_lo_v16qi"
2488 [(set (match_operand:V8HI 0 "register_operand" "=v")
2489 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
2490 (match_operand:V16QI 2 "register_operand" "v")]
2495 rtx ve = gen_reg_rtx (V8HImode);
2496 rtx vo = gen_reg_rtx (V8HImode);
2498 emit_insn (gen_altivec_vmuleub (ve, operands[1], operands[2]));
2499 emit_insn (gen_altivec_vmuloub (vo, operands[1], operands[2]));
2500 emit_insn (gen_altivec_vmrglh (operands[0], ve, vo));
2504 (define_expand "vec_widen_smult_hi_v16qi"
2505 [(set (match_operand:V8HI 0 "register_operand" "=v")
2506 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
2507 (match_operand:V16QI 2 "register_operand" "v")]
2512 rtx ve = gen_reg_rtx (V8HImode);
2513 rtx vo = gen_reg_rtx (V8HImode);
2515 emit_insn (gen_altivec_vmulesb (ve, operands[1], operands[2]));
2516 emit_insn (gen_altivec_vmulosb (vo, operands[1], operands[2]));
2517 emit_insn (gen_altivec_vmrghh (operands[0], ve, vo));
2521 (define_expand "vec_widen_smult_lo_v16qi"
2522 [(set (match_operand:V8HI 0 "register_operand" "=v")
2523 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
2524 (match_operand:V16QI 2 "register_operand" "v")]
2529 rtx ve = gen_reg_rtx (V8HImode);
2530 rtx vo = gen_reg_rtx (V8HImode);
2532 emit_insn (gen_altivec_vmulesb (ve, operands[1], operands[2]));
2533 emit_insn (gen_altivec_vmulosb (vo, operands[1], operands[2]));
2534 emit_insn (gen_altivec_vmrglh (operands[0], ve, vo));
2538 (define_expand "vec_widen_umult_hi_v8hi"
2539 [(set (match_operand:V4SI 0 "register_operand" "=v")
2540 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
2541 (match_operand:V8HI 2 "register_operand" "v")]
2546 rtx ve = gen_reg_rtx (V4SImode);
2547 rtx vo = gen_reg_rtx (V4SImode);
2549 emit_insn (gen_altivec_vmuleuh (ve, operands[1], operands[2]));
2550 emit_insn (gen_altivec_vmulouh (vo, operands[1], operands[2]));
2551 emit_insn (gen_altivec_vmrghw (operands[0], ve, vo));
2555 (define_expand "vec_widen_umult_lo_v8hi"
2556 [(set (match_operand:V4SI 0 "register_operand" "=v")
2557 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
2558 (match_operand:V8HI 2 "register_operand" "v")]
2563 rtx ve = gen_reg_rtx (V4SImode);
2564 rtx vo = gen_reg_rtx (V4SImode);
2566 emit_insn (gen_altivec_vmuleuh (ve, operands[1], operands[2]));
2567 emit_insn (gen_altivec_vmulouh (vo, operands[1], operands[2]));
2568 emit_insn (gen_altivec_vmrglw (operands[0], ve, vo));
2572 (define_expand "vec_widen_smult_hi_v8hi"
2573 [(set (match_operand:V4SI 0 "register_operand" "=v")
2574 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
2575 (match_operand:V8HI 2 "register_operand" "v")]
2580 rtx ve = gen_reg_rtx (V4SImode);
2581 rtx vo = gen_reg_rtx (V4SImode);
2583 emit_insn (gen_altivec_vmulesh (ve, operands[1], operands[2]));
2584 emit_insn (gen_altivec_vmulosh (vo, operands[1], operands[2]));
2585 emit_insn (gen_altivec_vmrghw (operands[0], ve, vo));
2589 (define_expand "vec_widen_smult_lo_v8hi"
2590 [(set (match_operand:V4SI 0 "register_operand" "=v")
2591 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
2592 (match_operand:V8HI 2 "register_operand" "v")]
2597 rtx ve = gen_reg_rtx (V4SImode);
2598 rtx vo = gen_reg_rtx (V4SImode);
2600 emit_insn (gen_altivec_vmulesh (ve, operands[1], operands[2]));
2601 emit_insn (gen_altivec_vmulosh (vo, operands[1], operands[2]));
2602 emit_insn (gen_altivec_vmrglw (operands[0], ve, vo));
2606 (define_expand "vec_pack_mod_v8hi"
2607 [(set (match_operand:V16QI 0 "register_operand" "=v")
2608 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
2609 (match_operand:V8HI 2 "register_operand" "v")]
2614 emit_insn (gen_altivec_vpkuhum (operands[0], operands[1], operands[2]));
2618 (define_expand "vec_pack_mod_v4si"
2619 [(set (match_operand:V8HI 0 "register_operand" "=v")
2620 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
2621 (match_operand:V4SI 2 "register_operand" "v")]
2626 emit_insn (gen_altivec_vpkuwum (operands[0], operands[1], operands[2]));
2630 (define_expand "negv4sf2"
2631 [(use (match_operand:V4SF 0 "register_operand" ""))
2632 (use (match_operand:V4SF 1 "register_operand" ""))]
2638 /* Generate [-0.0, -0.0, -0.0, -0.0]. */
2639 neg0 = gen_reg_rtx (V4SImode);
2640 emit_insn (gen_altivec_vspltisw (neg0, constm1_rtx));
2641 emit_insn (gen_altivec_vslw (neg0, neg0, neg0));
2644 emit_insn (gen_xorv4sf3 (operands[0],
2645 gen_lowpart (V4SFmode, neg0), operands[1]));
2650 (define_expand "vec_extract_evenv4si"
2651 [(set (match_operand:V4SI 0 "register_operand" "")
2652 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "")
2653 (match_operand:V4SI 2 "register_operand" "")]
2654 UNSPEC_EXTEVEN_V4SI))]
2658 rtx mask = gen_reg_rtx (V16QImode);
2659 rtvec v = rtvec_alloc (16);
2661 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 0);
2662 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 1);
2663 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 2);
2664 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 3);
2665 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 8);
2666 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 9);
2667 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 10);
2668 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 11);
2669 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2670 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 17);
2671 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 18);
2672 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 19);
2673 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 24);
2674 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 25);
2675 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 26);
2676 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 27);
2677 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2678 emit_insn (gen_altivec_vperm_v4si (operands[0], operands[1], operands[2], mask));
2683 (define_expand "vec_extract_evenv4sf"
2684 [(set (match_operand:V4SF 0 "register_operand" "")
2685 (unspec:V8HI [(match_operand:V4SF 1 "register_operand" "")
2686 (match_operand:V4SF 2 "register_operand" "")]
2687 UNSPEC_EXTEVEN_V4SF))]
2691 rtx mask = gen_reg_rtx (V16QImode);
2692 rtvec v = rtvec_alloc (16);
2694 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 0);
2695 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 1);
2696 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 2);
2697 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 3);
2698 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 8);
2699 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 9);
2700 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 10);
2701 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 11);
2702 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2703 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 17);
2704 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 18);
2705 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 19);
2706 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 24);
2707 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 25);
2708 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 26);
2709 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 27);
2710 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2711 emit_insn (gen_altivec_vperm_v4sf (operands[0], operands[1], operands[2], mask));
2716 (define_expand "vec_extract_evenv8hi"
2717 [(set (match_operand:V4SI 0 "register_operand" "")
2718 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "")
2719 (match_operand:V8HI 2 "register_operand" "")]
2720 UNSPEC_EXTEVEN_V8HI))]
2724 rtx mask = gen_reg_rtx (V16QImode);
2725 rtvec v = rtvec_alloc (16);
2727 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 0);
2728 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 1);
2729 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 4);
2730 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 5);
2731 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 8);
2732 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 9);
2733 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 12);
2734 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 13);
2735 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2736 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 17);
2737 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 20);
2738 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 21);
2739 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 24);
2740 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 25);
2741 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 28);
2742 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 29);
2743 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2744 emit_insn (gen_altivec_vperm_v8hi (operands[0], operands[1], operands[2], mask));
2749 (define_expand "vec_extract_evenv16qi"
2750 [(set (match_operand:V4SI 0 "register_operand" "")
2751 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "")
2752 (match_operand:V16QI 2 "register_operand" "")]
2753 UNSPEC_EXTEVEN_V16QI))]
2757 rtx mask = gen_reg_rtx (V16QImode);
2758 rtvec v = rtvec_alloc (16);
2760 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 0);
2761 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 2);
2762 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 4);
2763 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 6);
2764 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 8);
2765 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 10);
2766 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 12);
2767 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 14);
2768 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2769 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 18);
2770 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 20);
2771 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 22);
2772 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 24);
2773 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 26);
2774 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 28);
2775 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 30);
2776 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2777 emit_insn (gen_altivec_vperm_v16qi (operands[0], operands[1], operands[2], mask));
2782 (define_expand "vec_extract_oddv4si"
2783 [(set (match_operand:V4SI 0 "register_operand" "")
2784 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "")
2785 (match_operand:V4SI 2 "register_operand" "")]
2786 UNSPEC_EXTODD_V4SI))]
2790 rtx mask = gen_reg_rtx (V16QImode);
2791 rtvec v = rtvec_alloc (16);
2793 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 4);
2794 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 5);
2795 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 6);
2796 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 7);
2797 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 12);
2798 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 13);
2799 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 14);
2800 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 15);
2801 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 20);
2802 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 21);
2803 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 22);
2804 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 23);
2805 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 28);
2806 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 29);
2807 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 30);
2808 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 31);
2809 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2810 emit_insn (gen_altivec_vperm_v4si (operands[0], operands[1], operands[2], mask));
2815 (define_expand "vec_extract_oddv4sf"
2816 [(set (match_operand:V4SF 0 "register_operand" "")
2817 (unspec:V8HI [(match_operand:V4SF 1 "register_operand" "")
2818 (match_operand:V4SF 2 "register_operand" "")]
2819 UNSPEC_EXTODD_V4SF))]
2823 rtx mask = gen_reg_rtx (V16QImode);
2824 rtvec v = rtvec_alloc (16);
2826 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 4);
2827 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 5);
2828 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 6);
2829 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 7);
2830 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 12);
2831 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 13);
2832 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 14);
2833 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 15);
2834 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 20);
2835 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 21);
2836 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 22);
2837 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 23);
2838 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 28);
2839 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 29);
2840 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 30);
2841 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 31);
2842 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2843 emit_insn (gen_altivec_vperm_v4sf (operands[0], operands[1], operands[2], mask));
2848 (define_insn "vpkuhum_nomode"
2849 [(set (match_operand:V16QI 0 "register_operand" "=v")
2850 (unspec:V16QI [(match_operand 1 "register_operand" "v")
2851 (match_operand 2 "register_operand" "v")]
2855 [(set_attr "type" "vecperm")])
2857 (define_insn "vpkuwum_nomode"
2858 [(set (match_operand:V8HI 0 "register_operand" "=v")
2859 (unspec:V8HI [(match_operand 1 "register_operand" "v")
2860 (match_operand 2 "register_operand" "v")]
2864 [(set_attr "type" "vecperm")])
2866 (define_expand "vec_extract_oddv8hi"
2867 [(set (match_operand:V8HI 0 "register_operand" "")
2868 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "")
2869 (match_operand:V8HI 2 "register_operand" "")]
2870 UNSPEC_EXTODD_V8HI))]
2874 emit_insn (gen_vpkuwum_nomode (operands[0], operands[1], operands[2]));
2878 (define_expand "vec_extract_oddv16qi"
2879 [(set (match_operand:V16QI 0 "register_operand" "")
2880 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "")
2881 (match_operand:V16QI 2 "register_operand" "")]
2882 UNSPEC_EXTODD_V16QI))]
2886 emit_insn (gen_vpkuhum_nomode (operands[0], operands[1], operands[2]));
2889 (define_expand "vec_interleave_highv4sf"
2890 [(set (match_operand:V4SF 0 "register_operand" "")
2891 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "")
2892 (match_operand:V4SF 2 "register_operand" "")]
2893 UNSPEC_INTERHI_V4SF))]
2897 emit_insn (gen_altivec_vmrghsf (operands[0], operands[1], operands[2]));
2901 (define_expand "vec_interleave_lowv4sf"
2902 [(set (match_operand:V4SF 0 "register_operand" "")
2903 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "")
2904 (match_operand:V4SF 2 "register_operand" "")]
2905 UNSPEC_INTERLO_V4SF))]
2909 emit_insn (gen_altivec_vmrglsf (operands[0], operands[1], operands[2]));
2913 (define_expand "vec_interleave_high<mode>"
2914 [(set (match_operand:VI 0 "register_operand" "")
2915 (unspec:VI [(match_operand:VI 1 "register_operand" "")
2916 (match_operand:VI 2 "register_operand" "")]
2921 emit_insn (gen_altivec_vmrgh<VI_char> (operands[0], operands[1], operands[2]));
2925 (define_expand "vec_interleave_low<mode>"
2926 [(set (match_operand:VI 0 "register_operand" "")
2927 (unspec:VI [(match_operand:VI 1 "register_operand" "")
2928 (match_operand:VI 2 "register_operand" "")]
2933 emit_insn (gen_altivec_vmrgl<VI_char> (operands[0], operands[1], operands[2]));