2 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
3 ;; Free Software Foundation, Inc.
4 ;; Contributed by Aldy Hernandez (aldy@quesejoda.com)
6 ;; This file is part of GCC.
8 ;; GCC is free software; you can redistribute it and/or modify it
9 ;; under the terms of the GNU General Public License as published
10 ;; by the Free Software Foundation; either version 3, or (at your
11 ;; option) any later version.
13 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
14 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
16 ;; License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING3. If not see
20 ;; <http://www.gnu.org/licenses/>.
22 (define_c_enum "unspec"
140 (define_c_enum "unspecv"
149 (define_mode_iterator VI [V4SI V8HI V16QI])
150 ;; Short vec in modes
151 (define_mode_iterator VIshort [V8HI V16QI])
153 (define_mode_iterator VF [V4SF])
154 ;; Vec modes, pity mode iterators are not composable
155 (define_mode_iterator V [V4SI V8HI V16QI V4SF])
156 ;; Vec modes for move/logical/permute ops, include vector types for move not
157 ;; otherwise handled by altivec (v2df, v2di, ti)
158 (define_mode_iterator VM [V4SI V8HI V16QI V4SF V2DF V2DI TI])
160 ;; Like VM, except don't do TImode
161 (define_mode_iterator VM2 [V4SI V8HI V16QI V4SF V2DF V2DI])
163 (define_mode_attr VI_char [(V4SI "w") (V8HI "h") (V16QI "b")])
164 (define_mode_attr VI_scalar [(V4SI "SI") (V8HI "HI") (V16QI "QI")])
166 ;; Vector move instructions.
167 (define_insn "*altivec_mov<mode>"
168 [(set (match_operand:VM2 0 "nonimmediate_operand" "=Z,v,v,*o,*r,*r,v,v")
169 (match_operand:VM2 1 "input_operand" "v,Z,v,r,o,r,j,W"))]
170 "VECTOR_MEM_ALTIVEC_P (<MODE>mode)
171 && (register_operand (operands[0], <MODE>mode)
172 || register_operand (operands[1], <MODE>mode))"
174 switch (which_alternative)
176 case 0: return "stvx %1,%y0";
177 case 1: return "lvx %0,%y1";
178 case 2: return "vor %0,%1,%1";
182 case 6: return "vxor %0,%0,%0";
183 case 7: return output_vec_const_move (operands);
184 default: gcc_unreachable ();
187 [(set_attr "type" "vecstore,vecload,vecsimple,store,load,*,vecsimple,*")])
189 ;; Unlike other altivec moves, allow the GPRs, since a normal use of TImode
190 ;; is for unions. However for plain data movement, slightly favor the vector
192 (define_insn "*altivec_movti"
193 [(set (match_operand:TI 0 "nonimmediate_operand" "=Z,v,v,?o,?r,?r,v,v")
194 (match_operand:TI 1 "input_operand" "v,Z,v,r,o,r,j,W"))]
195 "VECTOR_MEM_ALTIVEC_P (TImode)
196 && (register_operand (operands[0], TImode)
197 || register_operand (operands[1], TImode))"
199 switch (which_alternative)
201 case 0: return "stvx %1,%y0";
202 case 1: return "lvx %0,%y1";
203 case 2: return "vor %0,%1,%1";
207 case 6: return "vxor %0,%0,%0";
208 case 7: return output_vec_const_move (operands);
209 default: gcc_unreachable ();
212 [(set_attr "type" "vecstore,vecload,vecsimple,store,load,*,vecsimple,*")])
214 ;; Load up a vector with the most significant bit set by loading up -1 and
215 ;; doing a shift left
217 [(set (match_operand:VM 0 "altivec_register_operand" "")
218 (match_operand:VM 1 "easy_vector_constant_msb" ""))]
219 "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode) && reload_completed"
222 rtx dest = operands[0];
223 enum machine_mode mode = GET_MODE (operands[0]);
227 if (mode == V4SFmode)
230 dest = gen_lowpart (V4SImode, dest);
233 num_elements = GET_MODE_NUNITS (mode);
234 v = rtvec_alloc (num_elements);
235 for (i = 0; i < num_elements; i++)
236 RTVEC_ELT (v, i) = constm1_rtx;
238 emit_insn (gen_vec_initv4si (dest, gen_rtx_PARALLEL (mode, v)));
239 emit_insn (gen_rtx_SET (VOIDmode, dest, gen_rtx_ASHIFT (mode, dest, dest)));
244 [(set (match_operand:VM 0 "altivec_register_operand" "")
245 (match_operand:VM 1 "easy_vector_constant_add_self" ""))]
246 "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode) && reload_completed"
247 [(set (match_dup 0) (match_dup 3))
248 (set (match_dup 0) (match_dup 4))]
250 rtx dup = gen_easy_altivec_constant (operands[1]);
252 enum machine_mode op_mode = <MODE>mode;
254 /* Divide the operand of the resulting VEC_DUPLICATE, and use
255 simplify_rtx to make a CONST_VECTOR. */
256 XEXP (dup, 0) = simplify_const_binary_operation (ASHIFTRT, QImode,
257 XEXP (dup, 0), const1_rtx);
258 const_vec = simplify_rtx (dup);
260 if (op_mode == V4SFmode)
263 operands[0] = gen_lowpart (op_mode, operands[0]);
265 if (GET_MODE (const_vec) == op_mode)
266 operands[3] = const_vec;
268 operands[3] = gen_lowpart (op_mode, const_vec);
269 operands[4] = gen_rtx_PLUS (op_mode, operands[0], operands[0]);
272 (define_insn "get_vrsave_internal"
273 [(set (match_operand:SI 0 "register_operand" "=r")
274 (unspec:SI [(reg:SI 109)] UNSPEC_GET_VRSAVE))]
278 return "mfspr %0,256";
280 return "mfvrsave %0";
282 [(set_attr "type" "*")])
284 (define_insn "*set_vrsave_internal"
285 [(match_parallel 0 "vrsave_operation"
287 (unspec_volatile:SI [(match_operand:SI 1 "register_operand" "r")
288 (reg:SI 109)] UNSPECV_SET_VRSAVE))])]
292 return "mtspr 256,%1";
294 return "mtvrsave %1";
296 [(set_attr "type" "*")])
298 (define_insn "*save_world"
299 [(match_parallel 0 "save_world_operation"
300 [(clobber (reg:SI 65))
301 (use (match_operand:SI 1 "call_operand" "s"))])]
302 "TARGET_MACHO && (DEFAULT_ABI == ABI_DARWIN) && TARGET_32BIT"
304 [(set_attr "type" "branch")
305 (set_attr "length" "4")])
307 (define_insn "*restore_world"
308 [(match_parallel 0 "restore_world_operation"
311 (use (match_operand:SI 1 "call_operand" "s"))
312 (clobber (match_operand:SI 2 "gpc_reg_operand" "=r"))])]
313 "TARGET_MACHO && (DEFAULT_ABI == ABI_DARWIN) && TARGET_32BIT"
316 ;; Simple binary operations.
319 (define_insn "add<mode>3"
320 [(set (match_operand:VI 0 "register_operand" "=v")
321 (plus:VI (match_operand:VI 1 "register_operand" "v")
322 (match_operand:VI 2 "register_operand" "v")))]
324 "vaddu<VI_char>m %0,%1,%2"
325 [(set_attr "type" "vecsimple")])
327 (define_insn "*altivec_addv4sf3"
328 [(set (match_operand:V4SF 0 "register_operand" "=v")
329 (plus:V4SF (match_operand:V4SF 1 "register_operand" "v")
330 (match_operand:V4SF 2 "register_operand" "v")))]
331 "VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
333 [(set_attr "type" "vecfloat")])
335 (define_insn "altivec_vaddcuw"
336 [(set (match_operand:V4SI 0 "register_operand" "=v")
337 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
338 (match_operand:V4SI 2 "register_operand" "v")]
342 [(set_attr "type" "vecsimple")])
344 (define_insn "altivec_vaddu<VI_char>s"
345 [(set (match_operand:VI 0 "register_operand" "=v")
346 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
347 (match_operand:VI 2 "register_operand" "v")]
349 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
351 "vaddu<VI_char>s %0,%1,%2"
352 [(set_attr "type" "vecsimple")])
354 (define_insn "altivec_vadds<VI_char>s"
355 [(set (match_operand:VI 0 "register_operand" "=v")
356 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
357 (match_operand:VI 2 "register_operand" "v")]
359 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
361 "vadds<VI_char>s %0,%1,%2"
362 [(set_attr "type" "vecsimple")])
365 (define_insn "sub<mode>3"
366 [(set (match_operand:VI 0 "register_operand" "=v")
367 (minus:VI (match_operand:VI 1 "register_operand" "v")
368 (match_operand:VI 2 "register_operand" "v")))]
370 "vsubu<VI_char>m %0,%1,%2"
371 [(set_attr "type" "vecsimple")])
373 (define_insn "*altivec_subv4sf3"
374 [(set (match_operand:V4SF 0 "register_operand" "=v")
375 (minus:V4SF (match_operand:V4SF 1 "register_operand" "v")
376 (match_operand:V4SF 2 "register_operand" "v")))]
377 "VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
379 [(set_attr "type" "vecfloat")])
381 (define_insn "altivec_vsubcuw"
382 [(set (match_operand:V4SI 0 "register_operand" "=v")
383 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
384 (match_operand:V4SI 2 "register_operand" "v")]
388 [(set_attr "type" "vecsimple")])
390 (define_insn "altivec_vsubu<VI_char>s"
391 [(set (match_operand:VI 0 "register_operand" "=v")
392 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
393 (match_operand:VI 2 "register_operand" "v")]
395 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
397 "vsubu<VI_char>s %0,%1,%2"
398 [(set_attr "type" "vecsimple")])
400 (define_insn "altivec_vsubs<VI_char>s"
401 [(set (match_operand:VI 0 "register_operand" "=v")
402 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
403 (match_operand:VI 2 "register_operand" "v")]
405 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
407 "vsubs<VI_char>s %0,%1,%2"
408 [(set_attr "type" "vecsimple")])
411 (define_insn "altivec_vavgu<VI_char>"
412 [(set (match_operand:VI 0 "register_operand" "=v")
413 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
414 (match_operand:VI 2 "register_operand" "v")]
417 "vavgu<VI_char> %0,%1,%2"
418 [(set_attr "type" "vecsimple")])
420 (define_insn "altivec_vavgs<VI_char>"
421 [(set (match_operand:VI 0 "register_operand" "=v")
422 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
423 (match_operand:VI 2 "register_operand" "v")]
426 "vavgs<VI_char> %0,%1,%2"
427 [(set_attr "type" "vecsimple")])
429 (define_insn "altivec_vcmpbfp"
430 [(set (match_operand:V4SI 0 "register_operand" "=v")
431 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
432 (match_operand:V4SF 2 "register_operand" "v")]
436 [(set_attr "type" "veccmp")])
438 (define_insn "*altivec_eq<mode>"
439 [(set (match_operand:VI 0 "altivec_register_operand" "=v")
440 (eq:VI (match_operand:VI 1 "altivec_register_operand" "v")
441 (match_operand:VI 2 "altivec_register_operand" "v")))]
443 "vcmpequ<VI_char> %0,%1,%2"
444 [(set_attr "type" "veccmp")])
446 (define_insn "*altivec_gt<mode>"
447 [(set (match_operand:VI 0 "altivec_register_operand" "=v")
448 (gt:VI (match_operand:VI 1 "altivec_register_operand" "v")
449 (match_operand:VI 2 "altivec_register_operand" "v")))]
451 "vcmpgts<VI_char> %0,%1,%2"
452 [(set_attr "type" "veccmp")])
454 (define_insn "*altivec_gtu<mode>"
455 [(set (match_operand:VI 0 "altivec_register_operand" "=v")
456 (gtu:VI (match_operand:VI 1 "altivec_register_operand" "v")
457 (match_operand:VI 2 "altivec_register_operand" "v")))]
459 "vcmpgtu<VI_char> %0,%1,%2"
460 [(set_attr "type" "veccmp")])
462 (define_insn "*altivec_eqv4sf"
463 [(set (match_operand:V4SF 0 "altivec_register_operand" "=v")
464 (eq:V4SF (match_operand:V4SF 1 "altivec_register_operand" "v")
465 (match_operand:V4SF 2 "altivec_register_operand" "v")))]
466 "VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
468 [(set_attr "type" "veccmp")])
470 (define_insn "*altivec_gtv4sf"
471 [(set (match_operand:V4SF 0 "altivec_register_operand" "=v")
472 (gt:V4SF (match_operand:V4SF 1 "altivec_register_operand" "v")
473 (match_operand:V4SF 2 "altivec_register_operand" "v")))]
474 "VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
476 [(set_attr "type" "veccmp")])
478 (define_insn "*altivec_gev4sf"
479 [(set (match_operand:V4SF 0 "altivec_register_operand" "=v")
480 (ge:V4SF (match_operand:V4SF 1 "altivec_register_operand" "v")
481 (match_operand:V4SF 2 "altivec_register_operand" "v")))]
482 "VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
484 [(set_attr "type" "veccmp")])
486 (define_insn "*altivec_vsel<mode>"
487 [(set (match_operand:VM 0 "altivec_register_operand" "=v")
489 (ne:CC (match_operand:VM 1 "altivec_register_operand" "v")
490 (match_operand:VM 4 "zero_constant" ""))
491 (match_operand:VM 2 "altivec_register_operand" "v")
492 (match_operand:VM 3 "altivec_register_operand" "v")))]
493 "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
495 [(set_attr "type" "vecperm")])
497 (define_insn "*altivec_vsel<mode>_uns"
498 [(set (match_operand:VM 0 "altivec_register_operand" "=v")
500 (ne:CCUNS (match_operand:VM 1 "altivec_register_operand" "v")
501 (match_operand:VM 4 "zero_constant" ""))
502 (match_operand:VM 2 "altivec_register_operand" "v")
503 (match_operand:VM 3 "altivec_register_operand" "v")))]
504 "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
506 [(set_attr "type" "vecperm")])
508 ;; Fused multiply add.
510 (define_insn "*altivec_fmav4sf4"
511 [(set (match_operand:V4SF 0 "register_operand" "=v")
512 (fma:V4SF (match_operand:V4SF 1 "register_operand" "v")
513 (match_operand:V4SF 2 "register_operand" "v")
514 (match_operand:V4SF 3 "register_operand" "v")))]
515 "VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
516 "vmaddfp %0,%1,%2,%3"
517 [(set_attr "type" "vecfloat")])
519 ;; We do multiply as a fused multiply-add with an add of a -0.0 vector.
521 (define_expand "altivec_mulv4sf3"
522 [(set (match_operand:V4SF 0 "register_operand" "")
523 (fma:V4SF (match_operand:V4SF 1 "register_operand" "")
524 (match_operand:V4SF 2 "register_operand" "")
526 "VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
530 /* Generate [-0.0, -0.0, -0.0, -0.0]. */
531 neg0 = gen_reg_rtx (V4SImode);
532 emit_insn (gen_altivec_vspltisw (neg0, constm1_rtx));
533 emit_insn (gen_vashlv4si3 (neg0, neg0, neg0));
535 operands[3] = gen_lowpart (V4SFmode, neg0);
538 ;; 32-bit integer multiplication
539 ;; A_high = Operand_0 & 0xFFFF0000 >> 16
540 ;; A_low = Operand_0 & 0xFFFF
541 ;; B_high = Operand_1 & 0xFFFF0000 >> 16
542 ;; B_low = Operand_1 & 0xFFFF
543 ;; result = A_low * B_low + (A_high * B_low + B_high * A_low) << 16
545 ;; (define_insn "mulv4si3"
546 ;; [(set (match_operand:V4SI 0 "register_operand" "=v")
547 ;; (mult:V4SI (match_operand:V4SI 1 "register_operand" "v")
548 ;; (match_operand:V4SI 2 "register_operand" "v")))]
549 (define_expand "mulv4si3"
550 [(use (match_operand:V4SI 0 "register_operand" ""))
551 (use (match_operand:V4SI 1 "register_operand" ""))
552 (use (match_operand:V4SI 2 "register_operand" ""))]
565 zero = gen_reg_rtx (V4SImode);
566 emit_insn (gen_altivec_vspltisw (zero, const0_rtx));
568 sixteen = gen_reg_rtx (V4SImode);
569 emit_insn (gen_altivec_vspltisw (sixteen, gen_rtx_CONST_INT (V4SImode, -16)));
571 swap = gen_reg_rtx (V4SImode);
572 emit_insn (gen_vrotlv4si3 (swap, operands[2], sixteen));
574 one = gen_reg_rtx (V8HImode);
575 convert_move (one, operands[1], 0);
577 two = gen_reg_rtx (V8HImode);
578 convert_move (two, operands[2], 0);
580 small_swap = gen_reg_rtx (V8HImode);
581 convert_move (small_swap, swap, 0);
583 low_product = gen_reg_rtx (V4SImode);
584 emit_insn (gen_altivec_vmulouh (low_product, one, two));
586 high_product = gen_reg_rtx (V4SImode);
587 emit_insn (gen_altivec_vmsumuhm (high_product, one, small_swap, zero));
589 emit_insn (gen_vashlv4si3 (high_product, high_product, sixteen));
591 emit_insn (gen_addv4si3 (operands[0], high_product, low_product));
596 (define_expand "mulv8hi3"
597 [(use (match_operand:V8HI 0 "register_operand" ""))
598 (use (match_operand:V8HI 1 "register_operand" ""))
599 (use (match_operand:V8HI 2 "register_operand" ""))]
603 rtx odd = gen_reg_rtx (V4SImode);
604 rtx even = gen_reg_rtx (V4SImode);
605 rtx high = gen_reg_rtx (V4SImode);
606 rtx low = gen_reg_rtx (V4SImode);
608 emit_insn (gen_altivec_vmulesh (even, operands[1], operands[2]));
609 emit_insn (gen_altivec_vmulosh (odd, operands[1], operands[2]));
611 emit_insn (gen_altivec_vmrghw (high, even, odd));
612 emit_insn (gen_altivec_vmrglw (low, even, odd));
614 emit_insn (gen_altivec_vpkuwum (operands[0], high, low));
619 ;; Fused multiply subtract
620 (define_insn "*altivec_vnmsubfp"
621 [(set (match_operand:V4SF 0 "register_operand" "=v")
623 (fma:V4SF (match_operand:V4SF 1 "register_operand" "v")
624 (match_operand:V4SF 2 "register_operand" "v")
626 (match_operand:V4SF 3 "register_operand" "v")))))]
627 "VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
628 "vnmsubfp %0,%1,%2,%3"
629 [(set_attr "type" "vecfloat")])
631 (define_insn "altivec_vmsumu<VI_char>m"
632 [(set (match_operand:V4SI 0 "register_operand" "=v")
633 (unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v")
634 (match_operand:VIshort 2 "register_operand" "v")
635 (match_operand:V4SI 3 "register_operand" "v")]
638 "vmsumu<VI_char>m %0,%1,%2,%3"
639 [(set_attr "type" "veccomplex")])
641 (define_insn "altivec_vmsumm<VI_char>m"
642 [(set (match_operand:V4SI 0 "register_operand" "=v")
643 (unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v")
644 (match_operand:VIshort 2 "register_operand" "v")
645 (match_operand:V4SI 3 "register_operand" "v")]
648 "vmsumm<VI_char>m %0,%1,%2,%3"
649 [(set_attr "type" "veccomplex")])
651 (define_insn "altivec_vmsumshm"
652 [(set (match_operand:V4SI 0 "register_operand" "=v")
653 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
654 (match_operand:V8HI 2 "register_operand" "v")
655 (match_operand:V4SI 3 "register_operand" "v")]
658 "vmsumshm %0,%1,%2,%3"
659 [(set_attr "type" "veccomplex")])
661 (define_insn "altivec_vmsumuhs"
662 [(set (match_operand:V4SI 0 "register_operand" "=v")
663 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
664 (match_operand:V8HI 2 "register_operand" "v")
665 (match_operand:V4SI 3 "register_operand" "v")]
667 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
669 "vmsumuhs %0,%1,%2,%3"
670 [(set_attr "type" "veccomplex")])
672 (define_insn "altivec_vmsumshs"
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")]
678 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
680 "vmsumshs %0,%1,%2,%3"
681 [(set_attr "type" "veccomplex")])
685 (define_insn "umax<mode>3"
686 [(set (match_operand:VI 0 "register_operand" "=v")
687 (umax:VI (match_operand:VI 1 "register_operand" "v")
688 (match_operand:VI 2 "register_operand" "v")))]
690 "vmaxu<VI_char> %0,%1,%2"
691 [(set_attr "type" "vecsimple")])
693 (define_insn "smax<mode>3"
694 [(set (match_operand:VI 0 "register_operand" "=v")
695 (smax:VI (match_operand:VI 1 "register_operand" "v")
696 (match_operand:VI 2 "register_operand" "v")))]
698 "vmaxs<VI_char> %0,%1,%2"
699 [(set_attr "type" "vecsimple")])
701 (define_insn "*altivec_smaxv4sf3"
702 [(set (match_operand:V4SF 0 "register_operand" "=v")
703 (smax:V4SF (match_operand:V4SF 1 "register_operand" "v")
704 (match_operand:V4SF 2 "register_operand" "v")))]
705 "VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
707 [(set_attr "type" "veccmp")])
709 (define_insn "umin<mode>3"
710 [(set (match_operand:VI 0 "register_operand" "=v")
711 (umin:VI (match_operand:VI 1 "register_operand" "v")
712 (match_operand:VI 2 "register_operand" "v")))]
714 "vminu<VI_char> %0,%1,%2"
715 [(set_attr "type" "vecsimple")])
717 (define_insn "smin<mode>3"
718 [(set (match_operand:VI 0 "register_operand" "=v")
719 (smin:VI (match_operand:VI 1 "register_operand" "v")
720 (match_operand:VI 2 "register_operand" "v")))]
722 "vmins<VI_char> %0,%1,%2"
723 [(set_attr "type" "vecsimple")])
725 (define_insn "*altivec_sminv4sf3"
726 [(set (match_operand:V4SF 0 "register_operand" "=v")
727 (smin:V4SF (match_operand:V4SF 1 "register_operand" "v")
728 (match_operand:V4SF 2 "register_operand" "v")))]
729 "VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
731 [(set_attr "type" "veccmp")])
733 (define_insn "altivec_vmhaddshs"
734 [(set (match_operand:V8HI 0 "register_operand" "=v")
735 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
736 (match_operand:V8HI 2 "register_operand" "v")
737 (match_operand:V8HI 3 "register_operand" "v")]
739 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
741 "vmhaddshs %0,%1,%2,%3"
742 [(set_attr "type" "veccomplex")])
744 (define_insn "altivec_vmhraddshs"
745 [(set (match_operand:V8HI 0 "register_operand" "=v")
746 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
747 (match_operand:V8HI 2 "register_operand" "v")
748 (match_operand:V8HI 3 "register_operand" "v")]
750 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
752 "vmhraddshs %0,%1,%2,%3"
753 [(set_attr "type" "veccomplex")])
755 (define_insn "altivec_vmladduhm"
756 [(set (match_operand:V8HI 0 "register_operand" "=v")
757 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
758 (match_operand:V8HI 2 "register_operand" "v")
759 (match_operand:V8HI 3 "register_operand" "v")]
762 "vmladduhm %0,%1,%2,%3"
763 [(set_attr "type" "veccomplex")])
765 (define_insn "altivec_vmrghb"
766 [(set (match_operand:V16QI 0 "register_operand" "=v")
767 (vec_merge:V16QI (vec_select:V16QI (match_operand:V16QI 1 "register_operand" "v")
768 (parallel [(const_int 0)
784 (vec_select:V16QI (match_operand:V16QI 2 "register_operand" "v")
785 (parallel [(const_int 8)
804 [(set_attr "type" "vecperm")])
806 (define_insn "altivec_vmrghh"
807 [(set (match_operand:V8HI 0 "register_operand" "=v")
808 (vec_merge:V8HI (vec_select:V8HI (match_operand:V8HI 1 "register_operand" "v")
809 (parallel [(const_int 0)
817 (vec_select:V8HI (match_operand:V8HI 2 "register_operand" "v")
818 (parallel [(const_int 4)
829 [(set_attr "type" "vecperm")])
831 (define_insn "altivec_vmrghw"
832 [(set (match_operand:V4SI 0 "register_operand" "=v")
833 (vec_merge:V4SI (vec_select:V4SI (match_operand:V4SI 1 "register_operand" "v")
834 (parallel [(const_int 0)
838 (vec_select:V4SI (match_operand:V4SI 2 "register_operand" "v")
839 (parallel [(const_int 2)
844 "VECTOR_MEM_ALTIVEC_P (V4SImode)"
846 [(set_attr "type" "vecperm")])
848 (define_insn "*altivec_vmrghsf"
849 [(set (match_operand:V4SF 0 "register_operand" "=v")
850 (vec_merge:V4SF (vec_select:V4SF (match_operand:V4SF 1 "register_operand" "v")
851 (parallel [(const_int 0)
855 (vec_select:V4SF (match_operand:V4SF 2 "register_operand" "v")
856 (parallel [(const_int 2)
861 "VECTOR_MEM_ALTIVEC_P (V4SFmode)"
863 [(set_attr "type" "vecperm")])
865 (define_insn "altivec_vmrglb"
866 [(set (match_operand:V16QI 0 "register_operand" "=v")
867 (vec_merge:V16QI (vec_select:V16QI (match_operand:V16QI 1 "register_operand" "v")
868 (parallel [(const_int 8)
884 (vec_select:V16QI (match_operand:V16QI 2 "register_operand" "v")
885 (parallel [(const_int 0)
904 [(set_attr "type" "vecperm")])
906 (define_insn "altivec_vmrglh"
907 [(set (match_operand:V8HI 0 "register_operand" "=v")
908 (vec_merge:V8HI (vec_select:V8HI (match_operand:V8HI 1 "register_operand" "v")
909 (parallel [(const_int 4)
917 (vec_select:V8HI (match_operand:V8HI 2 "register_operand" "v")
918 (parallel [(const_int 0)
929 [(set_attr "type" "vecperm")])
931 (define_insn "altivec_vmrglw"
932 [(set (match_operand:V4SI 0 "register_operand" "=v")
934 (vec_select:V4SI (match_operand:V4SI 1 "register_operand" "v")
935 (parallel [(const_int 2)
939 (vec_select:V4SI (match_operand:V4SI 2 "register_operand" "v")
940 (parallel [(const_int 0)
945 "VECTOR_MEM_ALTIVEC_P (V4SImode)"
947 [(set_attr "type" "vecperm")])
949 (define_insn "*altivec_vmrglsf"
950 [(set (match_operand:V4SF 0 "register_operand" "=v")
952 (vec_select:V4SF (match_operand:V4SF 1 "register_operand" "v")
953 (parallel [(const_int 2)
957 (vec_select:V4SF (match_operand:V4SF 2 "register_operand" "v")
958 (parallel [(const_int 0)
963 "VECTOR_MEM_ALTIVEC_P (V4SFmode)"
965 [(set_attr "type" "vecperm")])
967 (define_insn "altivec_vmuleub"
968 [(set (match_operand:V8HI 0 "register_operand" "=v")
969 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
970 (match_operand:V16QI 2 "register_operand" "v")]
974 [(set_attr "type" "veccomplex")])
976 (define_insn "altivec_vmulesb"
977 [(set (match_operand:V8HI 0 "register_operand" "=v")
978 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
979 (match_operand:V16QI 2 "register_operand" "v")]
983 [(set_attr "type" "veccomplex")])
985 (define_insn "altivec_vmuleuh"
986 [(set (match_operand:V4SI 0 "register_operand" "=v")
987 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
988 (match_operand:V8HI 2 "register_operand" "v")]
992 [(set_attr "type" "veccomplex")])
994 (define_insn "altivec_vmulesh"
995 [(set (match_operand:V4SI 0 "register_operand" "=v")
996 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
997 (match_operand:V8HI 2 "register_operand" "v")]
1001 [(set_attr "type" "veccomplex")])
1003 (define_insn "altivec_vmuloub"
1004 [(set (match_operand:V8HI 0 "register_operand" "=v")
1005 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
1006 (match_operand:V16QI 2 "register_operand" "v")]
1010 [(set_attr "type" "veccomplex")])
1012 (define_insn "altivec_vmulosb"
1013 [(set (match_operand:V8HI 0 "register_operand" "=v")
1014 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
1015 (match_operand:V16QI 2 "register_operand" "v")]
1019 [(set_attr "type" "veccomplex")])
1021 (define_insn "altivec_vmulouh"
1022 [(set (match_operand:V4SI 0 "register_operand" "=v")
1023 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
1024 (match_operand:V8HI 2 "register_operand" "v")]
1028 [(set_attr "type" "veccomplex")])
1030 (define_insn "altivec_vmulosh"
1031 [(set (match_operand:V4SI 0 "register_operand" "=v")
1032 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
1033 (match_operand:V8HI 2 "register_operand" "v")]
1037 [(set_attr "type" "veccomplex")])
1040 ;; logical ops. Have the logical ops follow the memory ops in
1041 ;; terms of whether to prefer VSX or Altivec
1043 (define_insn "*altivec_and<mode>3"
1044 [(set (match_operand:VM 0 "register_operand" "=v")
1045 (and:VM (match_operand:VM 1 "register_operand" "v")
1046 (match_operand:VM 2 "register_operand" "v")))]
1047 "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
1049 [(set_attr "type" "vecsimple")])
1051 (define_insn "*altivec_ior<mode>3"
1052 [(set (match_operand:VM 0 "register_operand" "=v")
1053 (ior:VM (match_operand:VM 1 "register_operand" "v")
1054 (match_operand:VM 2 "register_operand" "v")))]
1055 "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
1057 [(set_attr "type" "vecsimple")])
1059 (define_insn "*altivec_xor<mode>3"
1060 [(set (match_operand:VM 0 "register_operand" "=v")
1061 (xor:VM (match_operand:VM 1 "register_operand" "v")
1062 (match_operand:VM 2 "register_operand" "v")))]
1063 "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
1065 [(set_attr "type" "vecsimple")])
1067 (define_insn "*altivec_one_cmpl<mode>2"
1068 [(set (match_operand:VM 0 "register_operand" "=v")
1069 (not:VM (match_operand:VM 1 "register_operand" "v")))]
1070 "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
1072 [(set_attr "type" "vecsimple")])
1074 (define_insn "*altivec_nor<mode>3"
1075 [(set (match_operand:VM 0 "register_operand" "=v")
1076 (not:VM (ior:VM (match_operand:VM 1 "register_operand" "v")
1077 (match_operand:VM 2 "register_operand" "v"))))]
1078 "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
1080 [(set_attr "type" "vecsimple")])
1082 (define_insn "*altivec_andc<mode>3"
1083 [(set (match_operand:VM 0 "register_operand" "=v")
1084 (and:VM (not:VM (match_operand:VM 2 "register_operand" "v"))
1085 (match_operand:VM 1 "register_operand" "v")))]
1086 "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
1088 [(set_attr "type" "vecsimple")])
1090 (define_insn "altivec_vpkuhum"
1091 [(set (match_operand:V16QI 0 "register_operand" "=v")
1092 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
1093 (match_operand:V8HI 2 "register_operand" "v")]
1097 [(set_attr "type" "vecperm")])
1099 (define_insn "altivec_vpkuwum"
1100 [(set (match_operand:V8HI 0 "register_operand" "=v")
1101 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
1102 (match_operand:V4SI 2 "register_operand" "v")]
1106 [(set_attr "type" "vecperm")])
1108 (define_insn "altivec_vpkpx"
1109 [(set (match_operand:V8HI 0 "register_operand" "=v")
1110 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
1111 (match_operand:V4SI 2 "register_operand" "v")]
1115 [(set_attr "type" "vecperm")])
1117 (define_insn "altivec_vpkshss"
1118 [(set (match_operand:V16QI 0 "register_operand" "=v")
1119 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
1120 (match_operand:V8HI 2 "register_operand" "v")]
1122 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1125 [(set_attr "type" "vecperm")])
1127 (define_insn "altivec_vpkswss"
1128 [(set (match_operand:V8HI 0 "register_operand" "=v")
1129 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
1130 (match_operand:V4SI 2 "register_operand" "v")]
1132 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1135 [(set_attr "type" "vecperm")])
1137 (define_insn "altivec_vpkuhus"
1138 [(set (match_operand:V16QI 0 "register_operand" "=v")
1139 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
1140 (match_operand:V8HI 2 "register_operand" "v")]
1142 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1145 [(set_attr "type" "vecperm")])
1147 (define_insn "altivec_vpkshus"
1148 [(set (match_operand:V16QI 0 "register_operand" "=v")
1149 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
1150 (match_operand:V8HI 2 "register_operand" "v")]
1152 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1155 [(set_attr "type" "vecperm")])
1157 (define_insn "altivec_vpkuwus"
1158 [(set (match_operand:V8HI 0 "register_operand" "=v")
1159 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
1160 (match_operand:V4SI 2 "register_operand" "v")]
1162 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1165 [(set_attr "type" "vecperm")])
1167 (define_insn "altivec_vpkswus"
1168 [(set (match_operand:V8HI 0 "register_operand" "=v")
1169 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
1170 (match_operand:V4SI 2 "register_operand" "v")]
1172 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1175 [(set_attr "type" "vecperm")])
1177 (define_insn "*altivec_vrl<VI_char>"
1178 [(set (match_operand:VI 0 "register_operand" "=v")
1179 (rotate:VI (match_operand:VI 1 "register_operand" "v")
1180 (match_operand:VI 2 "register_operand" "v")))]
1182 "vrl<VI_char> %0,%1,%2"
1183 [(set_attr "type" "vecsimple")])
1185 (define_insn "altivec_vsl"
1186 [(set (match_operand:V4SI 0 "register_operand" "=v")
1187 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1188 (match_operand:V4SI 2 "register_operand" "v")]
1192 [(set_attr "type" "vecperm")])
1194 (define_insn "altivec_vslo"
1195 [(set (match_operand:V4SI 0 "register_operand" "=v")
1196 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1197 (match_operand:V4SI 2 "register_operand" "v")]
1201 [(set_attr "type" "vecperm")])
1203 (define_insn "*altivec_vsl<VI_char>"
1204 [(set (match_operand:VI 0 "register_operand" "=v")
1205 (ashift:VI (match_operand:VI 1 "register_operand" "v")
1206 (match_operand:VI 2 "register_operand" "v")))]
1208 "vsl<VI_char> %0,%1,%2"
1209 [(set_attr "type" "vecsimple")])
1211 (define_insn "*altivec_vsr<VI_char>"
1212 [(set (match_operand:VI 0 "register_operand" "=v")
1213 (lshiftrt:VI (match_operand:VI 1 "register_operand" "v")
1214 (match_operand:VI 2 "register_operand" "v")))]
1216 "vsr<VI_char> %0,%1,%2"
1217 [(set_attr "type" "vecsimple")])
1219 (define_insn "*altivec_vsra<VI_char>"
1220 [(set (match_operand:VI 0 "register_operand" "=v")
1221 (ashiftrt:VI (match_operand:VI 1 "register_operand" "v")
1222 (match_operand:VI 2 "register_operand" "v")))]
1224 "vsra<VI_char> %0,%1,%2"
1225 [(set_attr "type" "vecsimple")])
1227 (define_insn "altivec_vsr"
1228 [(set (match_operand:V4SI 0 "register_operand" "=v")
1229 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1230 (match_operand:V4SI 2 "register_operand" "v")]
1234 [(set_attr "type" "vecperm")])
1236 (define_insn "altivec_vsro"
1237 [(set (match_operand:V4SI 0 "register_operand" "=v")
1238 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1239 (match_operand:V4SI 2 "register_operand" "v")]
1243 [(set_attr "type" "vecperm")])
1245 (define_insn "altivec_vsum4ubs"
1246 [(set (match_operand:V4SI 0 "register_operand" "=v")
1247 (unspec:V4SI [(match_operand:V16QI 1 "register_operand" "v")
1248 (match_operand:V4SI 2 "register_operand" "v")]
1250 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1253 [(set_attr "type" "veccomplex")])
1255 (define_insn "altivec_vsum4s<VI_char>s"
1256 [(set (match_operand:V4SI 0 "register_operand" "=v")
1257 (unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v")
1258 (match_operand:V4SI 2 "register_operand" "v")]
1260 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1262 "vsum4s<VI_char>s %0,%1,%2"
1263 [(set_attr "type" "veccomplex")])
1265 (define_insn "altivec_vsum2sws"
1266 [(set (match_operand:V4SI 0 "register_operand" "=v")
1267 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1268 (match_operand:V4SI 2 "register_operand" "v")]
1270 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1273 [(set_attr "type" "veccomplex")])
1275 (define_insn "altivec_vsumsws"
1276 [(set (match_operand:V4SI 0 "register_operand" "=v")
1277 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1278 (match_operand:V4SI 2 "register_operand" "v")]
1280 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1283 [(set_attr "type" "veccomplex")])
1285 (define_insn "altivec_vspltb"
1286 [(set (match_operand:V16QI 0 "register_operand" "=v")
1287 (vec_duplicate:V16QI
1288 (vec_select:QI (match_operand:V16QI 1 "register_operand" "v")
1290 [(match_operand:QI 2 "u5bit_cint_operand" "")]))))]
1293 [(set_attr "type" "vecperm")])
1295 (define_insn "altivec_vsplth"
1296 [(set (match_operand:V8HI 0 "register_operand" "=v")
1298 (vec_select:HI (match_operand:V8HI 1 "register_operand" "v")
1300 [(match_operand:QI 2 "u5bit_cint_operand" "")]))))]
1303 [(set_attr "type" "vecperm")])
1305 (define_insn "altivec_vspltw"
1306 [(set (match_operand:V4SI 0 "register_operand" "=v")
1308 (vec_select:SI (match_operand:V4SI 1 "register_operand" "v")
1310 [(match_operand:QI 2 "u5bit_cint_operand" "i")]))))]
1313 [(set_attr "type" "vecperm")])
1315 (define_insn "altivec_vspltsf"
1316 [(set (match_operand:V4SF 0 "register_operand" "=v")
1318 (vec_select:SF (match_operand:V4SF 1 "register_operand" "v")
1320 [(match_operand:QI 2 "u5bit_cint_operand" "i")]))))]
1321 "VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
1323 [(set_attr "type" "vecperm")])
1325 (define_insn "altivec_vspltis<VI_char>"
1326 [(set (match_operand:VI 0 "register_operand" "=v")
1328 (match_operand:QI 1 "s5bit_cint_operand" "i")))]
1330 "vspltis<VI_char> %0,%1"
1331 [(set_attr "type" "vecperm")])
1333 (define_insn "*altivec_vrfiz"
1334 [(set (match_operand:V4SF 0 "register_operand" "=v")
1335 (fix:V4SF (match_operand:V4SF 1 "register_operand" "v")))]
1336 "VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
1338 [(set_attr "type" "vecfloat")])
1340 (define_insn "altivec_vperm_<mode>"
1341 [(set (match_operand:VM 0 "register_operand" "=v")
1342 (unspec:VM [(match_operand:VM 1 "register_operand" "v")
1343 (match_operand:VM 2 "register_operand" "v")
1344 (match_operand:V16QI 3 "register_operand" "v")]
1348 [(set_attr "type" "vecperm")])
1350 (define_insn "altivec_vperm_<mode>_uns"
1351 [(set (match_operand:VM 0 "register_operand" "=v")
1352 (unspec:VM [(match_operand:VM 1 "register_operand" "v")
1353 (match_operand:VM 2 "register_operand" "v")
1354 (match_operand:V16QI 3 "register_operand" "v")]
1358 [(set_attr "type" "vecperm")])
1360 (define_expand "vec_permv16qi"
1361 [(set (match_operand:V16QI 0 "register_operand" "")
1362 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "")
1363 (match_operand:V16QI 2 "register_operand" "")
1364 (match_operand:V16QI 3 "register_operand" "")]
1369 (define_insn "altivec_vrfip" ; ceil
1370 [(set (match_operand:V4SF 0 "register_operand" "=v")
1371 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1375 [(set_attr "type" "vecfloat")])
1377 (define_insn "altivec_vrfin"
1378 [(set (match_operand:V4SF 0 "register_operand" "=v")
1379 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1383 [(set_attr "type" "vecfloat")])
1385 (define_insn "*altivec_vrfim" ; floor
1386 [(set (match_operand:V4SF 0 "register_operand" "=v")
1387 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1391 [(set_attr "type" "vecfloat")])
1393 (define_insn "altivec_vcfux"
1394 [(set (match_operand:V4SF 0 "register_operand" "=v")
1395 (unspec:V4SF [(match_operand:V4SI 1 "register_operand" "v")
1396 (match_operand:QI 2 "immediate_operand" "i")]
1400 [(set_attr "type" "vecfloat")])
1402 (define_insn "altivec_vcfsx"
1403 [(set (match_operand:V4SF 0 "register_operand" "=v")
1404 (unspec:V4SF [(match_operand:V4SI 1 "register_operand" "v")
1405 (match_operand:QI 2 "immediate_operand" "i")]
1409 [(set_attr "type" "vecfloat")])
1411 (define_insn "altivec_vctuxs"
1412 [(set (match_operand:V4SI 0 "register_operand" "=v")
1413 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
1414 (match_operand:QI 2 "immediate_operand" "i")]
1416 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1419 [(set_attr "type" "vecfloat")])
1421 (define_insn "altivec_vctsxs"
1422 [(set (match_operand:V4SI 0 "register_operand" "=v")
1423 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
1424 (match_operand:QI 2 "immediate_operand" "i")]
1426 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1429 [(set_attr "type" "vecfloat")])
1431 (define_insn "altivec_vlogefp"
1432 [(set (match_operand:V4SF 0 "register_operand" "=v")
1433 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1437 [(set_attr "type" "vecfloat")])
1439 (define_insn "altivec_vexptefp"
1440 [(set (match_operand:V4SF 0 "register_operand" "=v")
1441 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1445 [(set_attr "type" "vecfloat")])
1447 (define_insn "*altivec_vrsqrtefp"
1448 [(set (match_operand:V4SF 0 "register_operand" "=v")
1449 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1451 "VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
1453 [(set_attr "type" "vecfloat")])
1455 (define_insn "altivec_vrefp"
1456 [(set (match_operand:V4SF 0 "register_operand" "=v")
1457 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1459 "VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
1461 [(set_attr "type" "vecfloat")])
1463 (define_expand "altivec_copysign_v4sf3"
1464 [(use (match_operand:V4SF 0 "register_operand" ""))
1465 (use (match_operand:V4SF 1 "register_operand" ""))
1466 (use (match_operand:V4SF 2 "register_operand" ""))]
1467 "VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
1470 rtx mask = gen_reg_rtx (V4SImode);
1471 rtvec v = rtvec_alloc (4);
1472 unsigned HOST_WIDE_INT mask_val = ((unsigned HOST_WIDE_INT)1) << 31;
1474 RTVEC_ELT (v, 0) = GEN_INT (mask_val);
1475 RTVEC_ELT (v, 1) = GEN_INT (mask_val);
1476 RTVEC_ELT (v, 2) = GEN_INT (mask_val);
1477 RTVEC_ELT (v, 3) = GEN_INT (mask_val);
1479 emit_insn (gen_vec_initv4si (mask, gen_rtx_PARALLEL (V4SImode, v)));
1480 emit_insn (gen_vector_select_v4sf (operands[0], operands[1], operands[2],
1481 gen_lowpart (V4SFmode, mask)));
1485 (define_insn "altivec_vsldoi_<mode>"
1486 [(set (match_operand:VM 0 "register_operand" "=v")
1487 (unspec:VM [(match_operand:VM 1 "register_operand" "v")
1488 (match_operand:VM 2 "register_operand" "v")
1489 (match_operand:QI 3 "immediate_operand" "i")]
1492 "vsldoi %0,%1,%2,%3"
1493 [(set_attr "type" "vecperm")])
1495 (define_insn "altivec_vupkhsb"
1496 [(set (match_operand:V8HI 0 "register_operand" "=v")
1497 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
1501 [(set_attr "type" "vecperm")])
1503 (define_insn "altivec_vupkhpx"
1504 [(set (match_operand:V4SI 0 "register_operand" "=v")
1505 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
1509 [(set_attr "type" "vecperm")])
1511 (define_insn "altivec_vupkhsh"
1512 [(set (match_operand:V4SI 0 "register_operand" "=v")
1513 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
1517 [(set_attr "type" "vecperm")])
1519 (define_insn "altivec_vupklsb"
1520 [(set (match_operand:V8HI 0 "register_operand" "=v")
1521 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
1525 [(set_attr "type" "vecperm")])
1527 (define_insn "altivec_vupklpx"
1528 [(set (match_operand:V4SI 0 "register_operand" "=v")
1529 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
1533 [(set_attr "type" "vecperm")])
1535 (define_insn "altivec_vupklsh"
1536 [(set (match_operand:V4SI 0 "register_operand" "=v")
1537 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
1541 [(set_attr "type" "vecperm")])
1543 ;; Compare vectors producing a vector result and a predicate, setting CR6 to
1544 ;; indicate a combined status
1545 (define_insn "*altivec_vcmpequ<VI_char>_p"
1547 (unspec:CC [(eq:CC (match_operand:VI 1 "register_operand" "v")
1548 (match_operand:VI 2 "register_operand" "v"))]
1550 (set (match_operand:VI 0 "register_operand" "=v")
1551 (eq:VI (match_dup 1)
1553 "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
1554 "vcmpequ<VI_char>. %0,%1,%2"
1555 [(set_attr "type" "veccmp")])
1557 (define_insn "*altivec_vcmpgts<VI_char>_p"
1559 (unspec:CC [(gt:CC (match_operand:VI 1 "register_operand" "v")
1560 (match_operand:VI 2 "register_operand" "v"))]
1562 (set (match_operand:VI 0 "register_operand" "=v")
1563 (gt:VI (match_dup 1)
1565 "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
1566 "vcmpgts<VI_char>. %0,%1,%2"
1567 [(set_attr "type" "veccmp")])
1569 (define_insn "*altivec_vcmpgtu<VI_char>_p"
1571 (unspec:CC [(gtu:CC (match_operand:VI 1 "register_operand" "v")
1572 (match_operand:VI 2 "register_operand" "v"))]
1574 (set (match_operand:VI 0 "register_operand" "=v")
1575 (gtu:VI (match_dup 1)
1577 "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
1578 "vcmpgtu<VI_char>. %0,%1,%2"
1579 [(set_attr "type" "veccmp")])
1581 (define_insn "*altivec_vcmpeqfp_p"
1583 (unspec:CC [(eq:CC (match_operand:V4SF 1 "register_operand" "v")
1584 (match_operand:V4SF 2 "register_operand" "v"))]
1586 (set (match_operand:V4SF 0 "register_operand" "=v")
1587 (eq:V4SF (match_dup 1)
1589 "VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
1590 "vcmpeqfp. %0,%1,%2"
1591 [(set_attr "type" "veccmp")])
1593 (define_insn "*altivec_vcmpgtfp_p"
1595 (unspec:CC [(gt:CC (match_operand:V4SF 1 "register_operand" "v")
1596 (match_operand:V4SF 2 "register_operand" "v"))]
1598 (set (match_operand:V4SF 0 "register_operand" "=v")
1599 (gt:V4SF (match_dup 1)
1601 "VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
1602 "vcmpgtfp. %0,%1,%2"
1603 [(set_attr "type" "veccmp")])
1605 (define_insn "*altivec_vcmpgefp_p"
1607 (unspec:CC [(ge:CC (match_operand:V4SF 1 "register_operand" "v")
1608 (match_operand:V4SF 2 "register_operand" "v"))]
1610 (set (match_operand:V4SF 0 "register_operand" "=v")
1611 (ge:V4SF (match_dup 1)
1613 "VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
1614 "vcmpgefp. %0,%1,%2"
1615 [(set_attr "type" "veccmp")])
1617 (define_insn "altivec_vcmpbfp_p"
1619 (unspec:CC [(match_operand:V4SF 1 "register_operand" "v")
1620 (match_operand:V4SF 2 "register_operand" "v")]
1622 (set (match_operand:V4SF 0 "register_operand" "=v")
1623 (unspec:V4SF [(match_dup 1)
1626 "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode)"
1628 [(set_attr "type" "veccmp")])
1630 (define_insn "altivec_mtvscr"
1633 [(match_operand:V4SI 0 "register_operand" "v")] UNSPECV_MTVSCR))]
1636 [(set_attr "type" "vecsimple")])
1638 (define_insn "altivec_mfvscr"
1639 [(set (match_operand:V8HI 0 "register_operand" "=v")
1640 (unspec_volatile:V8HI [(reg:SI 110)] UNSPECV_MFVSCR))]
1643 [(set_attr "type" "vecsimple")])
1645 (define_insn "altivec_dssall"
1646 [(unspec_volatile [(const_int 0)] UNSPECV_DSSALL)]
1649 [(set_attr "type" "vecsimple")])
1651 (define_insn "altivec_dss"
1652 [(unspec_volatile [(match_operand:QI 0 "immediate_operand" "i")]
1656 [(set_attr "type" "vecsimple")])
1658 (define_insn "altivec_dst"
1659 [(unspec [(match_operand 0 "register_operand" "b")
1660 (match_operand:SI 1 "register_operand" "r")
1661 (match_operand:QI 2 "immediate_operand" "i")] UNSPEC_DST)]
1662 "TARGET_ALTIVEC && GET_MODE (operands[0]) == Pmode"
1664 [(set_attr "type" "vecsimple")])
1666 (define_insn "altivec_dstt"
1667 [(unspec [(match_operand 0 "register_operand" "b")
1668 (match_operand:SI 1 "register_operand" "r")
1669 (match_operand:QI 2 "immediate_operand" "i")] UNSPEC_DSTT)]
1670 "TARGET_ALTIVEC && GET_MODE (operands[0]) == Pmode"
1672 [(set_attr "type" "vecsimple")])
1674 (define_insn "altivec_dstst"
1675 [(unspec [(match_operand 0 "register_operand" "b")
1676 (match_operand:SI 1 "register_operand" "r")
1677 (match_operand:QI 2 "immediate_operand" "i")] UNSPEC_DSTST)]
1678 "TARGET_ALTIVEC && GET_MODE (operands[0]) == Pmode"
1680 [(set_attr "type" "vecsimple")])
1682 (define_insn "altivec_dststt"
1683 [(unspec [(match_operand 0 "register_operand" "b")
1684 (match_operand:SI 1 "register_operand" "r")
1685 (match_operand:QI 2 "immediate_operand" "i")] UNSPEC_DSTSTT)]
1686 "TARGET_ALTIVEC && GET_MODE (operands[0]) == Pmode"
1688 [(set_attr "type" "vecsimple")])
1690 (define_insn "altivec_lvsl"
1691 [(set (match_operand:V16QI 0 "register_operand" "=v")
1692 (unspec:V16QI [(match_operand 1 "memory_operand" "Z")] UNSPEC_LVSL))]
1695 [(set_attr "type" "vecload")])
1697 (define_insn "altivec_lvsr"
1698 [(set (match_operand:V16QI 0 "register_operand" "=v")
1699 (unspec:V16QI [(match_operand 1 "memory_operand" "Z")] UNSPEC_LVSR))]
1702 [(set_attr "type" "vecload")])
1704 (define_expand "build_vector_mask_for_load"
1705 [(set (match_operand:V16QI 0 "register_operand" "")
1706 (unspec:V16QI [(match_operand 1 "memory_operand" "")] UNSPEC_LVSR))]
1713 gcc_assert (GET_CODE (operands[1]) == MEM);
1715 addr = XEXP (operands[1], 0);
1716 temp = gen_reg_rtx (GET_MODE (addr));
1717 emit_insn (gen_rtx_SET (VOIDmode, temp,
1718 gen_rtx_NEG (GET_MODE (addr), addr)));
1719 emit_insn (gen_altivec_lvsr (operands[0],
1720 replace_equiv_address (operands[1], temp)));
1724 ;; Parallel some of the LVE* and STV*'s with unspecs because some have
1725 ;; identical rtl but different instructions-- and gcc gets confused.
1727 (define_insn "altivec_lve<VI_char>x"
1729 [(set (match_operand:VI 0 "register_operand" "=v")
1730 (match_operand:VI 1 "memory_operand" "Z"))
1731 (unspec [(const_int 0)] UNSPEC_LVE)])]
1733 "lve<VI_char>x %0,%y1"
1734 [(set_attr "type" "vecload")])
1736 (define_insn "*altivec_lvesfx"
1738 [(set (match_operand:V4SF 0 "register_operand" "=v")
1739 (match_operand:V4SF 1 "memory_operand" "Z"))
1740 (unspec [(const_int 0)] UNSPEC_LVE)])]
1743 [(set_attr "type" "vecload")])
1745 (define_insn "altivec_lvxl"
1747 [(set (match_operand:V4SI 0 "register_operand" "=v")
1748 (match_operand:V4SI 1 "memory_operand" "Z"))
1749 (unspec [(const_int 0)] UNSPEC_SET_VSCR)])]
1752 [(set_attr "type" "vecload")])
1754 (define_insn "altivec_lvx_<mode>"
1756 [(set (match_operand:VM2 0 "register_operand" "=v")
1757 (match_operand:VM2 1 "memory_operand" "Z"))
1758 (unspec [(const_int 0)] UNSPEC_LVX)])]
1761 [(set_attr "type" "vecload")])
1763 (define_insn "altivec_stvx_<mode>"
1765 [(set (match_operand:VM2 0 "memory_operand" "=Z")
1766 (match_operand:VM2 1 "register_operand" "v"))
1767 (unspec [(const_int 0)] UNSPEC_STVX)])]
1770 [(set_attr "type" "vecstore")])
1772 (define_insn "altivec_stvxl"
1774 [(set (match_operand:V4SI 0 "memory_operand" "=Z")
1775 (match_operand:V4SI 1 "register_operand" "v"))
1776 (unspec [(const_int 0)] UNSPEC_STVXL)])]
1779 [(set_attr "type" "vecstore")])
1781 (define_insn "altivec_stve<VI_char>x"
1782 [(set (match_operand:<VI_scalar> 0 "memory_operand" "=Z")
1783 (unspec:<VI_scalar> [(match_operand:VI 1 "register_operand" "v")] UNSPEC_STVE))]
1785 "stve<VI_char>x %1,%y0"
1786 [(set_attr "type" "vecstore")])
1788 (define_insn "*altivec_stvesfx"
1789 [(set (match_operand:SF 0 "memory_operand" "=Z")
1790 (unspec:SF [(match_operand:V4SF 1 "register_operand" "v")] UNSPEC_STVE))]
1793 [(set_attr "type" "vecstore")])
1796 ;; vspltis? SCRATCH0,0
1797 ;; vsubu?m SCRATCH2,SCRATCH1,%1
1798 ;; vmaxs? %0,%1,SCRATCH2"
1799 (define_expand "abs<mode>2"
1800 [(set (match_dup 2) (vec_duplicate:VI (const_int 0)))
1802 (minus:VI (match_dup 2)
1803 (match_operand:VI 1 "register_operand" "v")))
1804 (set (match_operand:VI 0 "register_operand" "=v")
1805 (smax:VI (match_dup 1) (match_dup 3)))]
1808 operands[2] = gen_reg_rtx (GET_MODE (operands[0]));
1809 operands[3] = gen_reg_rtx (GET_MODE (operands[0]));
1813 ;; vspltisw SCRATCH1,-1
1814 ;; vslw SCRATCH2,SCRATCH1,SCRATCH1
1815 ;; vandc %0,%1,SCRATCH2
1816 (define_expand "altivec_absv4sf2"
1818 (vec_duplicate:V4SI (const_int -1)))
1820 (ashift:V4SI (match_dup 2) (match_dup 2)))
1821 (set (match_operand:V4SF 0 "register_operand" "=v")
1822 (and:V4SF (not:V4SF (subreg:V4SF (match_dup 3) 0))
1823 (match_operand:V4SF 1 "register_operand" "v")))]
1826 operands[2] = gen_reg_rtx (V4SImode);
1827 operands[3] = gen_reg_rtx (V4SImode);
1831 ;; vspltis? SCRATCH0,0
1832 ;; vsubs?s SCRATCH2,SCRATCH1,%1
1833 ;; vmaxs? %0,%1,SCRATCH2"
1834 (define_expand "altivec_abss_<mode>"
1835 [(set (match_dup 2) (vec_duplicate:VI (const_int 0)))
1836 (parallel [(set (match_dup 3)
1837 (unspec:VI [(match_dup 2)
1838 (match_operand:VI 1 "register_operand" "v")]
1840 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))])
1841 (set (match_operand:VI 0 "register_operand" "=v")
1842 (smax:VI (match_dup 1) (match_dup 3)))]
1845 operands[2] = gen_reg_rtx (GET_MODE (operands[0]));
1846 operands[3] = gen_reg_rtx (GET_MODE (operands[0]));
1849 (define_insn "altivec_vsumsws_nomode"
1850 [(set (match_operand 0 "register_operand" "=v")
1851 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1852 (match_operand:V4SI 2 "register_operand" "v")]
1854 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1857 [(set_attr "type" "veccomplex")])
1859 (define_expand "reduc_splus_<mode>"
1860 [(set (match_operand:VIshort 0 "register_operand" "=v")
1861 (unspec:VIshort [(match_operand:VIshort 1 "register_operand" "v")]
1862 UNSPEC_REDUC_PLUS))]
1866 rtx vzero = gen_reg_rtx (V4SImode);
1867 rtx vtmp1 = gen_reg_rtx (V4SImode);
1869 emit_insn (gen_altivec_vspltisw (vzero, const0_rtx));
1870 emit_insn (gen_altivec_vsum4s<VI_char>s (vtmp1, operands[1], vzero));
1871 emit_insn (gen_altivec_vsumsws_nomode (operands[0], vtmp1, vzero));
1875 (define_expand "reduc_uplus_v16qi"
1876 [(set (match_operand:V16QI 0 "register_operand" "=v")
1877 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")]
1878 UNSPEC_REDUC_PLUS))]
1882 rtx vzero = gen_reg_rtx (V4SImode);
1883 rtx vtmp1 = gen_reg_rtx (V4SImode);
1885 emit_insn (gen_altivec_vspltisw (vzero, const0_rtx));
1886 emit_insn (gen_altivec_vsum4ubs (vtmp1, operands[1], vzero));
1887 emit_insn (gen_altivec_vsumsws_nomode (operands[0], vtmp1, vzero));
1891 (define_expand "neg<mode>2"
1892 [(use (match_operand:VI 0 "register_operand" ""))
1893 (use (match_operand:VI 1 "register_operand" ""))]
1899 vzero = gen_reg_rtx (GET_MODE (operands[0]));
1900 emit_insn (gen_altivec_vspltis<VI_char> (vzero, const0_rtx));
1901 emit_insn (gen_sub<mode>3 (operands[0], vzero, operands[1]));
1906 (define_expand "udot_prod<mode>"
1907 [(set (match_operand:V4SI 0 "register_operand" "=v")
1908 (plus:V4SI (match_operand:V4SI 3 "register_operand" "v")
1909 (unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v")
1910 (match_operand:VIshort 2 "register_operand" "v")]
1915 emit_insn (gen_altivec_vmsumu<VI_char>m (operands[0], operands[1], operands[2], operands[3]));
1919 (define_expand "sdot_prodv8hi"
1920 [(set (match_operand:V4SI 0 "register_operand" "=v")
1921 (plus:V4SI (match_operand:V4SI 3 "register_operand" "v")
1922 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
1923 (match_operand:V8HI 2 "register_operand" "v")]
1928 emit_insn (gen_altivec_vmsumshm (operands[0], operands[1], operands[2], operands[3]));
1932 (define_expand "widen_usum<mode>3"
1933 [(set (match_operand:V4SI 0 "register_operand" "=v")
1934 (plus:V4SI (match_operand:V4SI 2 "register_operand" "v")
1935 (unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v")]
1940 rtx vones = gen_reg_rtx (GET_MODE (operands[1]));
1942 emit_insn (gen_altivec_vspltis<VI_char> (vones, const1_rtx));
1943 emit_insn (gen_altivec_vmsumu<VI_char>m (operands[0], operands[1], vones, operands[2]));
1947 (define_expand "widen_ssumv16qi3"
1948 [(set (match_operand:V4SI 0 "register_operand" "=v")
1949 (plus:V4SI (match_operand:V4SI 2 "register_operand" "v")
1950 (unspec:V4SI [(match_operand:V16QI 1 "register_operand" "v")]
1955 rtx vones = gen_reg_rtx (V16QImode);
1957 emit_insn (gen_altivec_vspltisb (vones, const1_rtx));
1958 emit_insn (gen_altivec_vmsummbm (operands[0], operands[1], vones, operands[2]));
1962 (define_expand "widen_ssumv8hi3"
1963 [(set (match_operand:V4SI 0 "register_operand" "=v")
1964 (plus:V4SI (match_operand:V4SI 2 "register_operand" "v")
1965 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
1970 rtx vones = gen_reg_rtx (V8HImode);
1972 emit_insn (gen_altivec_vspltish (vones, const1_rtx));
1973 emit_insn (gen_altivec_vmsumshm (operands[0], operands[1], vones, operands[2]));
1977 (define_expand "vec_unpacks_hi_v16qi"
1978 [(set (match_operand:V8HI 0 "register_operand" "=v")
1979 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
1984 emit_insn (gen_altivec_vupkhsb (operands[0], operands[1]));
1988 (define_expand "vec_unpacks_hi_v8hi"
1989 [(set (match_operand:V4SI 0 "register_operand" "=v")
1990 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
1995 emit_insn (gen_altivec_vupkhsh (operands[0], operands[1]));
1999 (define_expand "vec_unpacks_lo_v16qi"
2000 [(set (match_operand:V8HI 0 "register_operand" "=v")
2001 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
2006 emit_insn (gen_altivec_vupklsb (operands[0], operands[1]));
2010 (define_expand "vec_unpacks_lo_v8hi"
2011 [(set (match_operand:V4SI 0 "register_operand" "=v")
2012 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
2017 emit_insn (gen_altivec_vupklsh (operands[0], operands[1]));
2021 (define_insn "vperm_v8hiv4si"
2022 [(set (match_operand:V4SI 0 "register_operand" "=v")
2023 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
2024 (match_operand:V4SI 2 "register_operand" "v")
2025 (match_operand:V16QI 3 "register_operand" "v")]
2029 [(set_attr "type" "vecperm")])
2031 (define_insn "vperm_v16qiv8hi"
2032 [(set (match_operand:V8HI 0 "register_operand" "=v")
2033 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
2034 (match_operand:V8HI 2 "register_operand" "v")
2035 (match_operand:V16QI 3 "register_operand" "v")]
2039 [(set_attr "type" "vecperm")])
2042 (define_expand "vec_unpacku_hi_v16qi"
2043 [(set (match_operand:V8HI 0 "register_operand" "=v")
2044 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
2049 rtx vzero = gen_reg_rtx (V8HImode);
2050 rtx mask = gen_reg_rtx (V16QImode);
2051 rtvec v = rtvec_alloc (16);
2053 emit_insn (gen_altivec_vspltish (vzero, const0_rtx));
2055 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16);
2056 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 0);
2057 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 16);
2058 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 1);
2059 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16);
2060 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 2);
2061 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 16);
2062 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 3);
2063 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2064 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 4);
2065 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 16);
2066 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 5);
2067 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16);
2068 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 6);
2069 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 16);
2070 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 7);
2072 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2073 emit_insn (gen_vperm_v16qiv8hi (operands[0], operands[1], vzero, mask));
2077 (define_expand "vec_unpacku_hi_v8hi"
2078 [(set (match_operand:V4SI 0 "register_operand" "=v")
2079 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
2084 rtx vzero = gen_reg_rtx (V4SImode);
2085 rtx mask = gen_reg_rtx (V16QImode);
2086 rtvec v = rtvec_alloc (16);
2088 emit_insn (gen_altivec_vspltisw (vzero, const0_rtx));
2090 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16);
2091 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 17);
2092 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 0);
2093 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 1);
2094 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16);
2095 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 17);
2096 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 2);
2097 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 3);
2098 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2099 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 17);
2100 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 4);
2101 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 5);
2102 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16);
2103 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 17);
2104 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 6);
2105 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 7);
2107 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2108 emit_insn (gen_vperm_v8hiv4si (operands[0], operands[1], vzero, mask));
2112 (define_expand "vec_unpacku_lo_v16qi"
2113 [(set (match_operand:V8HI 0 "register_operand" "=v")
2114 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
2119 rtx vzero = gen_reg_rtx (V8HImode);
2120 rtx mask = gen_reg_rtx (V16QImode);
2121 rtvec v = rtvec_alloc (16);
2123 emit_insn (gen_altivec_vspltish (vzero, const0_rtx));
2125 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16);
2126 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 8);
2127 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 16);
2128 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 9);
2129 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16);
2130 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 10);
2131 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 16);
2132 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 11);
2133 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2134 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 12);
2135 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 16);
2136 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 13);
2137 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16);
2138 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 14);
2139 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 16);
2140 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 15);
2142 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2143 emit_insn (gen_vperm_v16qiv8hi (operands[0], operands[1], vzero, mask));
2147 (define_expand "vec_unpacku_lo_v8hi"
2148 [(set (match_operand:V4SI 0 "register_operand" "=v")
2149 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
2154 rtx vzero = gen_reg_rtx (V4SImode);
2155 rtx mask = gen_reg_rtx (V16QImode);
2156 rtvec v = rtvec_alloc (16);
2158 emit_insn (gen_altivec_vspltisw (vzero, const0_rtx));
2160 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16);
2161 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 17);
2162 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 8);
2163 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 9);
2164 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16);
2165 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 17);
2166 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 10);
2167 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 11);
2168 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2169 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 17);
2170 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 12);
2171 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 13);
2172 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16);
2173 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 17);
2174 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 14);
2175 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 15);
2177 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2178 emit_insn (gen_vperm_v8hiv4si (operands[0], operands[1], vzero, mask));
2182 (define_expand "vec_widen_umult_hi_v16qi"
2183 [(set (match_operand:V8HI 0 "register_operand" "=v")
2184 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
2185 (match_operand:V16QI 2 "register_operand" "v")]
2190 rtx ve = gen_reg_rtx (V8HImode);
2191 rtx vo = gen_reg_rtx (V8HImode);
2193 emit_insn (gen_altivec_vmuleub (ve, operands[1], operands[2]));
2194 emit_insn (gen_altivec_vmuloub (vo, operands[1], operands[2]));
2195 emit_insn (gen_altivec_vmrghh (operands[0], ve, vo));
2199 (define_expand "vec_widen_umult_lo_v16qi"
2200 [(set (match_operand:V8HI 0 "register_operand" "=v")
2201 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
2202 (match_operand:V16QI 2 "register_operand" "v")]
2207 rtx ve = gen_reg_rtx (V8HImode);
2208 rtx vo = gen_reg_rtx (V8HImode);
2210 emit_insn (gen_altivec_vmuleub (ve, operands[1], operands[2]));
2211 emit_insn (gen_altivec_vmuloub (vo, operands[1], operands[2]));
2212 emit_insn (gen_altivec_vmrglh (operands[0], ve, vo));
2216 (define_expand "vec_widen_smult_hi_v16qi"
2217 [(set (match_operand:V8HI 0 "register_operand" "=v")
2218 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
2219 (match_operand:V16QI 2 "register_operand" "v")]
2224 rtx ve = gen_reg_rtx (V8HImode);
2225 rtx vo = gen_reg_rtx (V8HImode);
2227 emit_insn (gen_altivec_vmulesb (ve, operands[1], operands[2]));
2228 emit_insn (gen_altivec_vmulosb (vo, operands[1], operands[2]));
2229 emit_insn (gen_altivec_vmrghh (operands[0], ve, vo));
2233 (define_expand "vec_widen_smult_lo_v16qi"
2234 [(set (match_operand:V8HI 0 "register_operand" "=v")
2235 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
2236 (match_operand:V16QI 2 "register_operand" "v")]
2241 rtx ve = gen_reg_rtx (V8HImode);
2242 rtx vo = gen_reg_rtx (V8HImode);
2244 emit_insn (gen_altivec_vmulesb (ve, operands[1], operands[2]));
2245 emit_insn (gen_altivec_vmulosb (vo, operands[1], operands[2]));
2246 emit_insn (gen_altivec_vmrglh (operands[0], ve, vo));
2250 (define_expand "vec_widen_umult_hi_v8hi"
2251 [(set (match_operand:V4SI 0 "register_operand" "=v")
2252 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
2253 (match_operand:V8HI 2 "register_operand" "v")]
2258 rtx ve = gen_reg_rtx (V4SImode);
2259 rtx vo = gen_reg_rtx (V4SImode);
2261 emit_insn (gen_altivec_vmuleuh (ve, operands[1], operands[2]));
2262 emit_insn (gen_altivec_vmulouh (vo, operands[1], operands[2]));
2263 emit_insn (gen_altivec_vmrghw (operands[0], ve, vo));
2267 (define_expand "vec_widen_umult_lo_v8hi"
2268 [(set (match_operand:V4SI 0 "register_operand" "=v")
2269 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
2270 (match_operand:V8HI 2 "register_operand" "v")]
2275 rtx ve = gen_reg_rtx (V4SImode);
2276 rtx vo = gen_reg_rtx (V4SImode);
2278 emit_insn (gen_altivec_vmuleuh (ve, operands[1], operands[2]));
2279 emit_insn (gen_altivec_vmulouh (vo, operands[1], operands[2]));
2280 emit_insn (gen_altivec_vmrglw (operands[0], ve, vo));
2284 (define_expand "vec_widen_smult_hi_v8hi"
2285 [(set (match_operand:V4SI 0 "register_operand" "=v")
2286 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
2287 (match_operand:V8HI 2 "register_operand" "v")]
2292 rtx ve = gen_reg_rtx (V4SImode);
2293 rtx vo = gen_reg_rtx (V4SImode);
2295 emit_insn (gen_altivec_vmulesh (ve, operands[1], operands[2]));
2296 emit_insn (gen_altivec_vmulosh (vo, operands[1], operands[2]));
2297 emit_insn (gen_altivec_vmrghw (operands[0], ve, vo));
2301 (define_expand "vec_widen_smult_lo_v8hi"
2302 [(set (match_operand:V4SI 0 "register_operand" "=v")
2303 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
2304 (match_operand:V8HI 2 "register_operand" "v")]
2309 rtx ve = gen_reg_rtx (V4SImode);
2310 rtx vo = gen_reg_rtx (V4SImode);
2312 emit_insn (gen_altivec_vmulesh (ve, operands[1], operands[2]));
2313 emit_insn (gen_altivec_vmulosh (vo, operands[1], operands[2]));
2314 emit_insn (gen_altivec_vmrglw (operands[0], ve, vo));
2318 (define_expand "vec_pack_trunc_v8hi"
2319 [(set (match_operand:V16QI 0 "register_operand" "=v")
2320 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
2321 (match_operand:V8HI 2 "register_operand" "v")]
2326 emit_insn (gen_altivec_vpkuhum (operands[0], operands[1], operands[2]));
2330 (define_expand "vec_pack_trunc_v4si"
2331 [(set (match_operand:V8HI 0 "register_operand" "=v")
2332 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
2333 (match_operand:V4SI 2 "register_operand" "v")]
2338 emit_insn (gen_altivec_vpkuwum (operands[0], operands[1], operands[2]));
2342 (define_expand "altivec_negv4sf2"
2343 [(use (match_operand:V4SF 0 "register_operand" ""))
2344 (use (match_operand:V4SF 1 "register_operand" ""))]
2350 /* Generate [-0.0, -0.0, -0.0, -0.0]. */
2351 neg0 = gen_reg_rtx (V4SImode);
2352 emit_insn (gen_altivec_vspltisw (neg0, constm1_rtx));
2353 emit_insn (gen_vashlv4si3 (neg0, neg0, neg0));
2356 emit_insn (gen_xorv4sf3 (operands[0],
2357 gen_lowpart (V4SFmode, neg0), operands[1]));
2362 ;; Vector SIMD PEM v2.06c defines LVLX, LVLXL, LVRX, LVRXL,
2363 ;; STVLX, STVLXL, STVVRX, STVRXL are available only on Cell.
2364 (define_insn "altivec_lvlx"
2365 [(set (match_operand:V16QI 0 "register_operand" "=v")
2366 (unspec:V16QI [(match_operand 1 "memory_operand" "Z")]
2368 "TARGET_ALTIVEC && rs6000_cpu == PROCESSOR_CELL"
2370 [(set_attr "type" "vecload")])
2372 (define_insn "altivec_lvlxl"
2373 [(set (match_operand:V16QI 0 "register_operand" "=v")
2374 (unspec:V16QI [(match_operand 1 "memory_operand" "Z")]
2376 "TARGET_ALTIVEC && rs6000_cpu == PROCESSOR_CELL"
2378 [(set_attr "type" "vecload")])
2380 (define_insn "altivec_lvrx"
2381 [(set (match_operand:V16QI 0 "register_operand" "=v")
2382 (unspec:V16QI [(match_operand 1 "memory_operand" "Z")]
2384 "TARGET_ALTIVEC && rs6000_cpu == PROCESSOR_CELL"
2386 [(set_attr "type" "vecload")])
2388 (define_insn "altivec_lvrxl"
2389 [(set (match_operand:V16QI 0 "register_operand" "=v")
2390 (unspec:V16QI [(match_operand 1 "memory_operand" "Z")]
2392 "TARGET_ALTIVEC && rs6000_cpu == PROCESSOR_CELL"
2394 [(set_attr "type" "vecload")])
2396 (define_insn "altivec_stvlx"
2398 [(set (match_operand:V4SI 0 "memory_operand" "=Z")
2399 (match_operand:V4SI 1 "register_operand" "v"))
2400 (unspec [(const_int 0)] UNSPEC_STVLX)])]
2401 "TARGET_ALTIVEC && rs6000_cpu == PROCESSOR_CELL"
2403 [(set_attr "type" "vecstore")])
2405 (define_insn "altivec_stvlxl"
2407 [(set (match_operand:V4SI 0 "memory_operand" "=Z")
2408 (match_operand:V4SI 1 "register_operand" "v"))
2409 (unspec [(const_int 0)] UNSPEC_STVLXL)])]
2410 "TARGET_ALTIVEC && rs6000_cpu == PROCESSOR_CELL"
2412 [(set_attr "type" "vecstore")])
2414 (define_insn "altivec_stvrx"
2416 [(set (match_operand:V4SI 0 "memory_operand" "=Z")
2417 (match_operand:V4SI 1 "register_operand" "v"))
2418 (unspec [(const_int 0)] UNSPEC_STVRX)])]
2419 "TARGET_ALTIVEC && rs6000_cpu == PROCESSOR_CELL"
2421 [(set_attr "type" "vecstore")])
2423 (define_insn "altivec_stvrxl"
2425 [(set (match_operand:V4SI 0 "memory_operand" "=Z")
2426 (match_operand:V4SI 1 "register_operand" "v"))
2427 (unspec [(const_int 0)] UNSPEC_STVRXL)])]
2428 "TARGET_ALTIVEC && rs6000_cpu == PROCESSOR_CELL"
2430 [(set_attr "type" "vecstore")])
2432 ;; ??? This is still used directly by vector.md
2433 (define_expand "vec_extract_evenv4si"
2434 [(set (match_operand:V4SI 0 "register_operand" "")
2435 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "")
2436 (match_operand:V4SI 2 "register_operand" "")]
2437 UNSPEC_EXTEVEN_V4SI))]
2441 rtx mask = gen_reg_rtx (V16QImode);
2442 rtvec v = rtvec_alloc (16);
2444 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 0);
2445 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 1);
2446 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 2);
2447 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 3);
2448 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 8);
2449 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 9);
2450 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 10);
2451 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 11);
2452 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2453 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 17);
2454 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 18);
2455 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 19);
2456 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 24);
2457 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 25);
2458 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 26);
2459 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 27);
2460 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2461 emit_insn (gen_altivec_vperm_v4si (operands[0], operands[1], operands[2], mask));
2466 ;; ??? This is still used directly by vector.md
2467 (define_expand "vec_extract_evenv4sf"
2468 [(set (match_operand:V4SF 0 "register_operand" "")
2469 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "")
2470 (match_operand:V4SF 2 "register_operand" "")]
2471 UNSPEC_EXTEVEN_V4SF))]
2475 rtx mask = gen_reg_rtx (V16QImode);
2476 rtvec v = rtvec_alloc (16);
2478 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 0);
2479 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 1);
2480 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 2);
2481 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 3);
2482 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 8);
2483 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 9);
2484 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 10);
2485 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 11);
2486 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2487 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 17);
2488 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 18);
2489 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 19);
2490 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 24);
2491 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 25);
2492 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 26);
2493 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 27);
2494 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2495 emit_insn (gen_altivec_vperm_v4sf (operands[0], operands[1], operands[2], mask));
2500 (define_insn "vpkuhum_nomode"
2501 [(set (match_operand:V16QI 0 "register_operand" "=v")
2502 (unspec:V16QI [(match_operand 1 "register_operand" "v")
2503 (match_operand 2 "register_operand" "v")]
2507 [(set_attr "type" "vecperm")])
2509 (define_insn "vpkuwum_nomode"
2510 [(set (match_operand:V8HI 0 "register_operand" "=v")
2511 (unspec:V8HI [(match_operand 1 "register_operand" "v")
2512 (match_operand 2 "register_operand" "v")]
2516 [(set_attr "type" "vecperm")])
2518 (define_expand "vec_extract_oddv8hi"
2519 [(set (match_operand:V8HI 0 "register_operand" "")
2520 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "")
2521 (match_operand:V8HI 2 "register_operand" "")]
2522 UNSPEC_EXTODD_V8HI))]
2526 emit_insn (gen_vpkuwum_nomode (operands[0], operands[1], operands[2]));
2530 (define_expand "vec_extract_oddv16qi"
2531 [(set (match_operand:V16QI 0 "register_operand" "")
2532 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "")
2533 (match_operand:V16QI 2 "register_operand" "")]
2534 UNSPEC_EXTODD_V16QI))]
2538 emit_insn (gen_vpkuhum_nomode (operands[0], operands[1], operands[2]));
2542 (define_expand "vec_interleave_high<mode>"
2543 [(set (match_operand:VI 0 "register_operand" "")
2544 (unspec:VI [(match_operand:VI 1 "register_operand" "")
2545 (match_operand:VI 2 "register_operand" "")]
2550 emit_insn (gen_altivec_vmrgh<VI_char> (operands[0], operands[1], operands[2]));
2554 (define_expand "vec_interleave_low<mode>"
2555 [(set (match_operand:VI 0 "register_operand" "")
2556 (unspec:VI [(match_operand:VI 1 "register_operand" "")
2557 (match_operand:VI 2 "register_operand" "")]
2562 emit_insn (gen_altivec_vmrgl<VI_char> (operands[0], operands[1], operands[2]));
2566 (define_expand "vec_unpacks_float_hi_v8hi"
2567 [(set (match_operand:V4SF 0 "register_operand" "")
2568 (unspec:V4SF [(match_operand:V8HI 1 "register_operand" "")]
2569 UNSPEC_VUPKHS_V4SF))]
2573 rtx tmp = gen_reg_rtx (V4SImode);
2575 emit_insn (gen_vec_unpacks_hi_v8hi (tmp, operands[1]));
2576 emit_insn (gen_altivec_vcfsx (operands[0], tmp, const0_rtx));
2580 (define_expand "vec_unpacks_float_lo_v8hi"
2581 [(set (match_operand:V4SF 0 "register_operand" "")
2582 (unspec:V4SF [(match_operand:V8HI 1 "register_operand" "")]
2583 UNSPEC_VUPKLS_V4SF))]
2587 rtx tmp = gen_reg_rtx (V4SImode);
2589 emit_insn (gen_vec_unpacks_lo_v8hi (tmp, operands[1]));
2590 emit_insn (gen_altivec_vcfsx (operands[0], tmp, const0_rtx));
2594 (define_expand "vec_unpacku_float_hi_v8hi"
2595 [(set (match_operand:V4SF 0 "register_operand" "")
2596 (unspec:V4SF [(match_operand:V8HI 1 "register_operand" "")]
2597 UNSPEC_VUPKHU_V4SF))]
2601 rtx tmp = gen_reg_rtx (V4SImode);
2603 emit_insn (gen_vec_unpacku_hi_v8hi (tmp, operands[1]));
2604 emit_insn (gen_altivec_vcfux (operands[0], tmp, const0_rtx));
2608 (define_expand "vec_unpacku_float_lo_v8hi"
2609 [(set (match_operand:V4SF 0 "register_operand" "")
2610 (unspec:V4SF [(match_operand:V8HI 1 "register_operand" "")]
2611 UNSPEC_VUPKLU_V4SF))]
2615 rtx tmp = gen_reg_rtx (V4SImode);
2617 emit_insn (gen_vec_unpacku_lo_v8hi (tmp, operands[1]));
2618 emit_insn (gen_altivec_vcfux (operands[0], tmp, const0_rtx));