2 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008
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/>.
42 (UNSPEC_VMHRADDSHS 72)
88 (UNSPEC_VRSQRTEFP 157)
101 (UNSPEC_PREDICATE 173)
112 (UNSPEC_SET_VSCR 213)
113 (UNSPEC_GET_VRSAVE 214)
114 (UNSPEC_REALIGN_LOAD 215)
115 (UNSPEC_REDUC_PLUS 217)
117 (UNSPEC_EXTEVEN_V4SI 220)
118 (UNSPEC_EXTEVEN_V8HI 221)
119 (UNSPEC_EXTEVEN_V16QI 222)
120 (UNSPEC_EXTEVEN_V4SF 223)
121 (UNSPEC_EXTODD_V4SI 224)
122 (UNSPEC_EXTODD_V8HI 225)
123 (UNSPEC_EXTODD_V16QI 226)
124 (UNSPEC_EXTODD_V4SF 227)
125 (UNSPEC_INTERHI_V4SI 228)
126 (UNSPEC_INTERHI_V8HI 229)
127 (UNSPEC_INTERHI_V16QI 230)
128 (UNSPEC_INTERHI_V4SF 231)
129 (UNSPEC_INTERLO_V4SI 232)
130 (UNSPEC_INTERLO_V8HI 233)
131 (UNSPEC_INTERLO_V16QI 234)
132 (UNSPEC_INTERLO_V4SF 235)
141 (UNSPEC_VMULWHUB 308)
142 (UNSPEC_VMULWLUB 309)
143 (UNSPEC_VMULWHSB 310)
144 (UNSPEC_VMULWLSB 311)
145 (UNSPEC_VMULWHUH 312)
146 (UNSPEC_VMULWLUH 313)
147 (UNSPEC_VMULWHSH 314)
148 (UNSPEC_VMULWLSH 315)
157 (UNSPEC_VUPKHS_V4SF 324)
158 (UNSPEC_VUPKLS_V4SF 325)
159 (UNSPEC_VUPKHU_V4SF 326)
160 (UNSPEC_VUPKLU_V4SF 327)
164 [(UNSPECV_SET_VRSAVE 30)
172 (define_mode_iterator VI [V4SI V8HI V16QI])
173 ;; Short vec in modes
174 (define_mode_iterator VIshort [V8HI V16QI])
176 (define_mode_iterator VF [V4SF])
177 ;; Vec modes, pity mode iterators are not composable
178 (define_mode_iterator V [V4SI V8HI V16QI V4SF])
180 (define_mode_attr VI_char [(V4SI "w") (V8HI "h") (V16QI "b")])
182 ;; Generic LVX load instruction.
183 (define_insn "altivec_lvx_<mode>"
184 [(set (match_operand:V 0 "altivec_register_operand" "=v")
185 (match_operand:V 1 "memory_operand" "Z"))]
188 [(set_attr "type" "vecload")])
190 ;; Generic STVX store instruction.
191 (define_insn "altivec_stvx_<mode>"
192 [(set (match_operand:V 0 "memory_operand" "=Z")
193 (match_operand:V 1 "altivec_register_operand" "v"))]
196 [(set_attr "type" "vecstore")])
198 ;; Vector move instructions.
199 (define_expand "mov<mode>"
200 [(set (match_operand:V 0 "nonimmediate_operand" "")
201 (match_operand:V 1 "any_operand" ""))]
204 rs6000_emit_move (operands[0], operands[1], <MODE>mode);
208 (define_insn "*mov<mode>_internal"
209 [(set (match_operand:V 0 "nonimmediate_operand" "=Z,v,v,o,r,r,v")
210 (match_operand:V 1 "input_operand" "v,Z,v,r,o,r,W"))]
212 && (register_operand (operands[0], <MODE>mode)
213 || register_operand (operands[1], <MODE>mode))"
215 switch (which_alternative)
217 case 0: return "stvx %1,%y0";
218 case 1: return "lvx %0,%y1";
219 case 2: return "vor %0,%1,%1";
223 case 6: return output_vec_const_move (operands);
224 default: gcc_unreachable ();
227 [(set_attr "type" "vecstore,vecload,vecsimple,store,load,*,*")])
230 [(set (match_operand:V4SI 0 "nonimmediate_operand" "")
231 (match_operand:V4SI 1 "input_operand" ""))]
232 "TARGET_ALTIVEC && reload_completed
233 && gpr_or_gpr_p (operands[0], operands[1])"
236 rs6000_split_multireg_move (operands[0], operands[1]); DONE;
240 [(set (match_operand:V8HI 0 "nonimmediate_operand" "")
241 (match_operand:V8HI 1 "input_operand" ""))]
242 "TARGET_ALTIVEC && reload_completed
243 && gpr_or_gpr_p (operands[0], operands[1])"
245 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
248 [(set (match_operand:V16QI 0 "nonimmediate_operand" "")
249 (match_operand:V16QI 1 "input_operand" ""))]
250 "TARGET_ALTIVEC && reload_completed
251 && gpr_or_gpr_p (operands[0], operands[1])"
253 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
256 [(set (match_operand:V4SF 0 "nonimmediate_operand" "")
257 (match_operand:V4SF 1 "input_operand" ""))]
258 "TARGET_ALTIVEC && reload_completed
259 && gpr_or_gpr_p (operands[0], operands[1])"
262 rs6000_split_multireg_move (operands[0], operands[1]); DONE;
266 [(set (match_operand:V 0 "altivec_register_operand" "")
267 (match_operand:V 1 "easy_vector_constant_add_self" ""))]
268 "TARGET_ALTIVEC && reload_completed"
269 [(set (match_dup 0) (match_dup 3))
270 (set (match_dup 0) (match_dup 4))]
272 rtx dup = gen_easy_altivec_constant (operands[1]);
274 enum machine_mode op_mode = <MODE>mode;
276 /* Divide the operand of the resulting VEC_DUPLICATE, and use
277 simplify_rtx to make a CONST_VECTOR. */
278 XEXP (dup, 0) = simplify_const_binary_operation (ASHIFTRT, QImode,
279 XEXP (dup, 0), const1_rtx);
280 const_vec = simplify_rtx (dup);
282 if (op_mode == V4SFmode)
285 operands[0] = gen_lowpart (op_mode, operands[0]);
287 if (GET_MODE (const_vec) == op_mode)
288 operands[3] = const_vec;
290 operands[3] = gen_lowpart (op_mode, const_vec);
291 operands[4] = gen_rtx_PLUS (op_mode, operands[0], operands[0]);
294 (define_insn "get_vrsave_internal"
295 [(set (match_operand:SI 0 "register_operand" "=r")
296 (unspec:SI [(reg:SI 109)] UNSPEC_GET_VRSAVE))]
300 return "mfspr %0,256";
302 return "mfvrsave %0";
304 [(set_attr "type" "*")])
306 (define_insn "*set_vrsave_internal"
307 [(match_parallel 0 "vrsave_operation"
309 (unspec_volatile:SI [(match_operand:SI 1 "register_operand" "r")
310 (reg:SI 109)] UNSPECV_SET_VRSAVE))])]
314 return "mtspr 256,%1";
316 return "mtvrsave %1";
318 [(set_attr "type" "*")])
320 (define_insn "*save_world"
321 [(match_parallel 0 "save_world_operation"
322 [(clobber (reg:SI 65))
323 (use (match_operand:SI 1 "call_operand" "s"))])]
324 "TARGET_MACHO && (DEFAULT_ABI == ABI_DARWIN) && TARGET_32BIT"
326 [(set_attr "type" "branch")
327 (set_attr "length" "4")])
329 (define_insn "*restore_world"
330 [(match_parallel 0 "restore_world_operation"
333 (use (match_operand:SI 1 "call_operand" "s"))
334 (clobber (match_operand:SI 2 "gpc_reg_operand" "=r"))])]
335 "TARGET_MACHO && (DEFAULT_ABI == ABI_DARWIN) && TARGET_32BIT"
338 ;; Simple binary operations.
341 (define_insn "add<mode>3"
342 [(set (match_operand:VI 0 "register_operand" "=v")
343 (plus:VI (match_operand:VI 1 "register_operand" "v")
344 (match_operand:VI 2 "register_operand" "v")))]
346 "vaddu<VI_char>m %0,%1,%2"
347 [(set_attr "type" "vecsimple")])
349 (define_insn "addv4sf3"
350 [(set (match_operand:V4SF 0 "register_operand" "=v")
351 (plus:V4SF (match_operand:V4SF 1 "register_operand" "v")
352 (match_operand:V4SF 2 "register_operand" "v")))]
355 [(set_attr "type" "vecfloat")])
357 (define_insn "altivec_vaddcuw"
358 [(set (match_operand:V4SI 0 "register_operand" "=v")
359 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
360 (match_operand:V4SI 2 "register_operand" "v")]
364 [(set_attr "type" "vecsimple")])
366 (define_insn "altivec_vaddu<VI_char>s"
367 [(set (match_operand:VI 0 "register_operand" "=v")
368 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
369 (match_operand:VI 2 "register_operand" "v")]
371 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
373 "vaddu<VI_char>s %0,%1,%2"
374 [(set_attr "type" "vecsimple")])
376 (define_insn "altivec_vadds<VI_char>s"
377 [(set (match_operand:VI 0 "register_operand" "=v")
378 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
379 (match_operand:VI 2 "register_operand" "v")]
381 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
383 "vadds<VI_char>s %0,%1,%2"
384 [(set_attr "type" "vecsimple")])
387 (define_insn "sub<mode>3"
388 [(set (match_operand:VI 0 "register_operand" "=v")
389 (minus:VI (match_operand:VI 1 "register_operand" "v")
390 (match_operand:VI 2 "register_operand" "v")))]
392 "vsubu<VI_char>m %0,%1,%2"
393 [(set_attr "type" "vecsimple")])
395 (define_insn "subv4sf3"
396 [(set (match_operand:V4SF 0 "register_operand" "=v")
397 (minus:V4SF (match_operand:V4SF 1 "register_operand" "v")
398 (match_operand:V4SF 2 "register_operand" "v")))]
401 [(set_attr "type" "vecfloat")])
403 (define_insn "altivec_vsubcuw"
404 [(set (match_operand:V4SI 0 "register_operand" "=v")
405 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
406 (match_operand:V4SI 2 "register_operand" "v")]
410 [(set_attr "type" "vecsimple")])
412 (define_insn "altivec_vsubu<VI_char>s"
413 [(set (match_operand:VI 0 "register_operand" "=v")
414 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
415 (match_operand:VI 2 "register_operand" "v")]
417 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
419 "vsubu<VI_char>s %0,%1,%2"
420 [(set_attr "type" "vecsimple")])
422 (define_insn "altivec_vsubs<VI_char>s"
423 [(set (match_operand:VI 0 "register_operand" "=v")
424 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
425 (match_operand:VI 2 "register_operand" "v")]
427 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
429 "vsubs<VI_char>s %0,%1,%2"
430 [(set_attr "type" "vecsimple")])
433 (define_insn "altivec_vavgu<VI_char>"
434 [(set (match_operand:VI 0 "register_operand" "=v")
435 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
436 (match_operand:VI 2 "register_operand" "v")]
439 "vavgu<VI_char> %0,%1,%2"
440 [(set_attr "type" "vecsimple")])
442 (define_insn "altivec_vavgs<VI_char>"
443 [(set (match_operand:VI 0 "register_operand" "=v")
444 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
445 (match_operand:VI 2 "register_operand" "v")]
448 "vavgs<VI_char> %0,%1,%2"
449 [(set_attr "type" "vecsimple")])
451 (define_insn "altivec_vcmpbfp"
452 [(set (match_operand:V4SI 0 "register_operand" "=v")
453 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
454 (match_operand:V4SF 2 "register_operand" "v")]
458 [(set_attr "type" "veccmp")])
460 (define_insn "altivec_vcmpequb"
461 [(set (match_operand:V16QI 0 "register_operand" "=v")
462 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
463 (match_operand:V16QI 2 "register_operand" "v")]
467 [(set_attr "type" "vecsimple")])
469 (define_insn "altivec_vcmpequh"
470 [(set (match_operand:V8HI 0 "register_operand" "=v")
471 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
472 (match_operand:V8HI 2 "register_operand" "v")]
476 [(set_attr "type" "vecsimple")])
478 (define_insn "altivec_vcmpequw"
479 [(set (match_operand:V4SI 0 "register_operand" "=v")
480 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
481 (match_operand:V4SI 2 "register_operand" "v")]
485 [(set_attr "type" "vecsimple")])
487 (define_insn "altivec_vcmpeqfp"
488 [(set (match_operand:V4SI 0 "register_operand" "=v")
489 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
490 (match_operand:V4SF 2 "register_operand" "v")]
494 [(set_attr "type" "veccmp")])
496 (define_insn "altivec_vcmpgefp"
497 [(set (match_operand:V4SI 0 "register_operand" "=v")
498 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
499 (match_operand:V4SF 2 "register_operand" "v")]
503 [(set_attr "type" "veccmp")])
505 (define_insn "altivec_vcmpgtub"
506 [(set (match_operand:V16QI 0 "register_operand" "=v")
507 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
508 (match_operand:V16QI 2 "register_operand" "v")]
512 [(set_attr "type" "vecsimple")])
514 (define_insn "altivec_vcmpgtsb"
515 [(set (match_operand:V16QI 0 "register_operand" "=v")
516 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
517 (match_operand:V16QI 2 "register_operand" "v")]
521 [(set_attr "type" "vecsimple")])
523 (define_insn "altivec_vcmpgtuh"
524 [(set (match_operand:V8HI 0 "register_operand" "=v")
525 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
526 (match_operand:V8HI 2 "register_operand" "v")]
530 [(set_attr "type" "vecsimple")])
532 (define_insn "altivec_vcmpgtsh"
533 [(set (match_operand:V8HI 0 "register_operand" "=v")
534 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
535 (match_operand:V8HI 2 "register_operand" "v")]
539 [(set_attr "type" "vecsimple")])
541 (define_insn "altivec_vcmpgtuw"
542 [(set (match_operand:V4SI 0 "register_operand" "=v")
543 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
544 (match_operand:V4SI 2 "register_operand" "v")]
548 [(set_attr "type" "vecsimple")])
550 (define_insn "altivec_vcmpgtsw"
551 [(set (match_operand:V4SI 0 "register_operand" "=v")
552 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
553 (match_operand:V4SI 2 "register_operand" "v")]
557 [(set_attr "type" "vecsimple")])
559 (define_insn "altivec_vcmpgtfp"
560 [(set (match_operand:V4SI 0 "register_operand" "=v")
561 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
562 (match_operand:V4SF 2 "register_operand" "v")]
566 [(set_attr "type" "veccmp")])
568 ;; Fused multiply add
569 (define_insn "altivec_vmaddfp"
570 [(set (match_operand:V4SF 0 "register_operand" "=v")
571 (plus:V4SF (mult:V4SF (match_operand:V4SF 1 "register_operand" "v")
572 (match_operand:V4SF 2 "register_operand" "v"))
573 (match_operand:V4SF 3 "register_operand" "v")))]
575 "vmaddfp %0,%1,%2,%3"
576 [(set_attr "type" "vecfloat")])
578 ;; We do multiply as a fused multiply-add with an add of a -0.0 vector.
580 (define_expand "mulv4sf3"
581 [(use (match_operand:V4SF 0 "register_operand" ""))
582 (use (match_operand:V4SF 1 "register_operand" ""))
583 (use (match_operand:V4SF 2 "register_operand" ""))]
584 "TARGET_ALTIVEC && TARGET_FUSED_MADD"
589 /* Generate [-0.0, -0.0, -0.0, -0.0]. */
590 neg0 = gen_reg_rtx (V4SImode);
591 emit_insn (gen_altivec_vspltisw (neg0, constm1_rtx));
592 emit_insn (gen_vashlv4si3 (neg0, neg0, neg0));
594 /* Use the multiply-add. */
595 emit_insn (gen_altivec_vmaddfp (operands[0], operands[1], operands[2],
596 gen_lowpart (V4SFmode, neg0)));
600 ;; 32-bit integer multiplication
601 ;; A_high = Operand_0 & 0xFFFF0000 >> 16
602 ;; A_low = Operand_0 & 0xFFFF
603 ;; B_high = Operand_1 & 0xFFFF0000 >> 16
604 ;; B_low = Operand_1 & 0xFFFF
605 ;; result = A_low * B_low + (A_high * B_low + B_high * A_low) << 16
607 ;; (define_insn "mulv4si3"
608 ;; [(set (match_operand:V4SI 0 "register_operand" "=v")
609 ;; (mult:V4SI (match_operand:V4SI 1 "register_operand" "v")
610 ;; (match_operand:V4SI 2 "register_operand" "v")))]
611 (define_expand "mulv4si3"
612 [(use (match_operand:V4SI 0 "register_operand" ""))
613 (use (match_operand:V4SI 1 "register_operand" ""))
614 (use (match_operand:V4SI 2 "register_operand" ""))]
627 zero = gen_reg_rtx (V4SImode);
628 emit_insn (gen_altivec_vspltisw (zero, const0_rtx));
630 sixteen = gen_reg_rtx (V4SImode);
631 emit_insn (gen_altivec_vspltisw (sixteen, gen_rtx_CONST_INT (V4SImode, -16)));
633 swap = gen_reg_rtx (V4SImode);
634 emit_insn (gen_altivec_vrlw (swap, operands[2], sixteen));
636 one = gen_reg_rtx (V8HImode);
637 convert_move (one, operands[1], 0);
639 two = gen_reg_rtx (V8HImode);
640 convert_move (two, operands[2], 0);
642 small_swap = gen_reg_rtx (V8HImode);
643 convert_move (small_swap, swap, 0);
645 low_product = gen_reg_rtx (V4SImode);
646 emit_insn (gen_altivec_vmulouh (low_product, one, two));
648 high_product = gen_reg_rtx (V4SImode);
649 emit_insn (gen_altivec_vmsumuhm (high_product, one, small_swap, zero));
651 emit_insn (gen_vashlv4si3 (high_product, high_product, sixteen));
653 emit_insn (gen_addv4si3 (operands[0], high_product, low_product));
658 (define_expand "mulv8hi3"
659 [(use (match_operand:V8HI 0 "register_operand" ""))
660 (use (match_operand:V8HI 1 "register_operand" ""))
661 (use (match_operand:V8HI 2 "register_operand" ""))]
665 rtx odd = gen_reg_rtx (V4SImode);
666 rtx even = gen_reg_rtx (V4SImode);
667 rtx high = gen_reg_rtx (V4SImode);
668 rtx low = gen_reg_rtx (V4SImode);
670 emit_insn (gen_altivec_vmulesh (even, operands[1], operands[2]));
671 emit_insn (gen_altivec_vmulosh (odd, operands[1], operands[2]));
673 emit_insn (gen_altivec_vmrghw (high, even, odd));
674 emit_insn (gen_altivec_vmrglw (low, even, odd));
676 emit_insn (gen_altivec_vpkuwum (operands[0], high, low));
681 ;; Fused multiply subtract
682 (define_insn "altivec_vnmsubfp"
683 [(set (match_operand:V4SF 0 "register_operand" "=v")
684 (neg:V4SF (minus:V4SF (mult:V4SF (match_operand:V4SF 1 "register_operand" "v")
685 (match_operand:V4SF 2 "register_operand" "v"))
686 (match_operand:V4SF 3 "register_operand" "v"))))]
688 "vnmsubfp %0,%1,%2,%3"
689 [(set_attr "type" "vecfloat")])
691 (define_insn "altivec_vmsumu<VI_char>m"
692 [(set (match_operand:V4SI 0 "register_operand" "=v")
693 (unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v")
694 (match_operand:VIshort 2 "register_operand" "v")
695 (match_operand:V4SI 3 "register_operand" "v")]
698 "vmsumu<VI_char>m %0,%1,%2,%3"
699 [(set_attr "type" "veccomplex")])
701 (define_insn "altivec_vmsumm<VI_char>m"
702 [(set (match_operand:V4SI 0 "register_operand" "=v")
703 (unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v")
704 (match_operand:VIshort 2 "register_operand" "v")
705 (match_operand:V4SI 3 "register_operand" "v")]
708 "vmsumm<VI_char>m %0,%1,%2,%3"
709 [(set_attr "type" "veccomplex")])
711 (define_insn "altivec_vmsumshm"
712 [(set (match_operand:V4SI 0 "register_operand" "=v")
713 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
714 (match_operand:V8HI 2 "register_operand" "v")
715 (match_operand:V4SI 3 "register_operand" "v")]
718 "vmsumshm %0,%1,%2,%3"
719 [(set_attr "type" "veccomplex")])
721 (define_insn "altivec_vmsumuhs"
722 [(set (match_operand:V4SI 0 "register_operand" "=v")
723 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
724 (match_operand:V8HI 2 "register_operand" "v")
725 (match_operand:V4SI 3 "register_operand" "v")]
727 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
729 "vmsumuhs %0,%1,%2,%3"
730 [(set_attr "type" "veccomplex")])
732 (define_insn "altivec_vmsumshs"
733 [(set (match_operand:V4SI 0 "register_operand" "=v")
734 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
735 (match_operand:V8HI 2 "register_operand" "v")
736 (match_operand:V4SI 3 "register_operand" "v")]
738 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
740 "vmsumshs %0,%1,%2,%3"
741 [(set_attr "type" "veccomplex")])
745 (define_insn "umax<mode>3"
746 [(set (match_operand:VI 0 "register_operand" "=v")
747 (umax:VI (match_operand:VI 1 "register_operand" "v")
748 (match_operand:VI 2 "register_operand" "v")))]
750 "vmaxu<VI_char> %0,%1,%2"
751 [(set_attr "type" "vecsimple")])
753 (define_insn "smax<mode>3"
754 [(set (match_operand:VI 0 "register_operand" "=v")
755 (smax:VI (match_operand:VI 1 "register_operand" "v")
756 (match_operand:VI 2 "register_operand" "v")))]
758 "vmaxs<VI_char> %0,%1,%2"
759 [(set_attr "type" "vecsimple")])
761 (define_insn "smaxv4sf3"
762 [(set (match_operand:V4SF 0 "register_operand" "=v")
763 (smax:V4SF (match_operand:V4SF 1 "register_operand" "v")
764 (match_operand:V4SF 2 "register_operand" "v")))]
767 [(set_attr "type" "veccmp")])
769 (define_insn "umin<mode>3"
770 [(set (match_operand:VI 0 "register_operand" "=v")
771 (umin:VI (match_operand:VI 1 "register_operand" "v")
772 (match_operand:VI 2 "register_operand" "v")))]
774 "vminu<VI_char> %0,%1,%2"
775 [(set_attr "type" "vecsimple")])
777 (define_insn "smin<mode>3"
778 [(set (match_operand:VI 0 "register_operand" "=v")
779 (smin:VI (match_operand:VI 1 "register_operand" "v")
780 (match_operand:VI 2 "register_operand" "v")))]
782 "vmins<VI_char> %0,%1,%2"
783 [(set_attr "type" "vecsimple")])
785 (define_insn "sminv4sf3"
786 [(set (match_operand:V4SF 0 "register_operand" "=v")
787 (smin:V4SF (match_operand:V4SF 1 "register_operand" "v")
788 (match_operand:V4SF 2 "register_operand" "v")))]
791 [(set_attr "type" "veccmp")])
793 (define_insn "altivec_vmhaddshs"
794 [(set (match_operand:V8HI 0 "register_operand" "=v")
795 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
796 (match_operand:V8HI 2 "register_operand" "v")
797 (match_operand:V8HI 3 "register_operand" "v")]
799 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
801 "vmhaddshs %0,%1,%2,%3"
802 [(set_attr "type" "veccomplex")])
804 (define_insn "altivec_vmhraddshs"
805 [(set (match_operand:V8HI 0 "register_operand" "=v")
806 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
807 (match_operand:V8HI 2 "register_operand" "v")
808 (match_operand:V8HI 3 "register_operand" "v")]
810 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
812 "vmhraddshs %0,%1,%2,%3"
813 [(set_attr "type" "veccomplex")])
815 (define_insn "altivec_vmladduhm"
816 [(set (match_operand:V8HI 0 "register_operand" "=v")
817 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
818 (match_operand:V8HI 2 "register_operand" "v")
819 (match_operand:V8HI 3 "register_operand" "v")]
822 "vmladduhm %0,%1,%2,%3"
823 [(set_attr "type" "veccomplex")])
825 (define_insn "altivec_vmrghb"
826 [(set (match_operand:V16QI 0 "register_operand" "=v")
827 (vec_merge:V16QI (vec_select:V16QI (match_operand:V16QI 1 "register_operand" "v")
828 (parallel [(const_int 0)
844 (vec_select:V16QI (match_operand:V16QI 2 "register_operand" "v")
845 (parallel [(const_int 8)
864 [(set_attr "type" "vecperm")])
866 (define_insn "altivec_vmrghh"
867 [(set (match_operand:V8HI 0 "register_operand" "=v")
868 (vec_merge:V8HI (vec_select:V8HI (match_operand:V8HI 1 "register_operand" "v")
869 (parallel [(const_int 0)
877 (vec_select:V8HI (match_operand:V8HI 2 "register_operand" "v")
878 (parallel [(const_int 4)
889 [(set_attr "type" "vecperm")])
891 (define_insn "altivec_vmrghw"
892 [(set (match_operand:V4SI 0 "register_operand" "=v")
893 (vec_merge:V4SI (vec_select:V4SI (match_operand:V4SI 1 "register_operand" "v")
894 (parallel [(const_int 0)
898 (vec_select:V4SI (match_operand:V4SI 2 "register_operand" "v")
899 (parallel [(const_int 2)
906 [(set_attr "type" "vecperm")])
908 (define_insn "altivec_vmrghsf"
909 [(set (match_operand:V4SF 0 "register_operand" "=v")
910 (vec_merge:V4SF (vec_select:V4SF (match_operand:V4SF 1 "register_operand" "v")
911 (parallel [(const_int 0)
915 (vec_select:V4SF (match_operand:V4SF 2 "register_operand" "v")
916 (parallel [(const_int 2)
923 [(set_attr "type" "vecperm")])
925 (define_insn "altivec_vmrglb"
926 [(set (match_operand:V16QI 0 "register_operand" "=v")
927 (vec_merge:V16QI (vec_select:V16QI (match_operand:V16QI 1 "register_operand" "v")
928 (parallel [(const_int 8)
944 (vec_select:V16QI (match_operand:V16QI 2 "register_operand" "v")
945 (parallel [(const_int 0)
964 [(set_attr "type" "vecperm")])
966 (define_insn "altivec_vmrglh"
967 [(set (match_operand:V8HI 0 "register_operand" "=v")
968 (vec_merge:V8HI (vec_select:V8HI (match_operand:V8HI 1 "register_operand" "v")
969 (parallel [(const_int 4)
977 (vec_select:V8HI (match_operand:V8HI 2 "register_operand" "v")
978 (parallel [(const_int 0)
989 [(set_attr "type" "vecperm")])
991 (define_insn "altivec_vmrglw"
992 [(set (match_operand:V4SI 0 "register_operand" "=v")
993 (vec_merge:V4SI (vec_select:V4SI (match_operand:V4SI 1 "register_operand" "v")
994 (parallel [(const_int 2)
998 (vec_select:V4SI (match_operand:V4SI 2 "register_operand" "v")
999 (parallel [(const_int 0)
1006 [(set_attr "type" "vecperm")])
1008 (define_insn "altivec_vmrglsf"
1009 [(set (match_operand:V4SF 0 "register_operand" "=v")
1010 (vec_merge:V4SF (vec_select:V4SF (match_operand:V4SF 1 "register_operand" "v")
1011 (parallel [(const_int 2)
1015 (vec_select:V4SF (match_operand:V4SF 2 "register_operand" "v")
1016 (parallel [(const_int 0)
1023 [(set_attr "type" "vecperm")])
1025 (define_insn "altivec_vmuleub"
1026 [(set (match_operand:V8HI 0 "register_operand" "=v")
1027 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
1028 (match_operand:V16QI 2 "register_operand" "v")]
1032 [(set_attr "type" "veccomplex")])
1034 (define_insn "altivec_vmulesb"
1035 [(set (match_operand:V8HI 0 "register_operand" "=v")
1036 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
1037 (match_operand:V16QI 2 "register_operand" "v")]
1041 [(set_attr "type" "veccomplex")])
1043 (define_insn "altivec_vmuleuh"
1044 [(set (match_operand:V4SI 0 "register_operand" "=v")
1045 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
1046 (match_operand:V8HI 2 "register_operand" "v")]
1050 [(set_attr "type" "veccomplex")])
1052 (define_insn "altivec_vmulesh"
1053 [(set (match_operand:V4SI 0 "register_operand" "=v")
1054 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
1055 (match_operand:V8HI 2 "register_operand" "v")]
1059 [(set_attr "type" "veccomplex")])
1061 (define_insn "altivec_vmuloub"
1062 [(set (match_operand:V8HI 0 "register_operand" "=v")
1063 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
1064 (match_operand:V16QI 2 "register_operand" "v")]
1068 [(set_attr "type" "veccomplex")])
1070 (define_insn "altivec_vmulosb"
1071 [(set (match_operand:V8HI 0 "register_operand" "=v")
1072 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
1073 (match_operand:V16QI 2 "register_operand" "v")]
1077 [(set_attr "type" "veccomplex")])
1079 (define_insn "altivec_vmulouh"
1080 [(set (match_operand:V4SI 0 "register_operand" "=v")
1081 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
1082 (match_operand:V8HI 2 "register_operand" "v")]
1086 [(set_attr "type" "veccomplex")])
1088 (define_insn "altivec_vmulosh"
1089 [(set (match_operand:V4SI 0 "register_operand" "=v")
1090 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
1091 (match_operand:V8HI 2 "register_operand" "v")]
1095 [(set_attr "type" "veccomplex")])
1100 (define_insn "and<mode>3"
1101 [(set (match_operand:VI 0 "register_operand" "=v")
1102 (and:VI (match_operand:VI 1 "register_operand" "v")
1103 (match_operand:VI 2 "register_operand" "v")))]
1106 [(set_attr "type" "vecsimple")])
1108 (define_insn "ior<mode>3"
1109 [(set (match_operand:VI 0 "register_operand" "=v")
1110 (ior:VI (match_operand:VI 1 "register_operand" "v")
1111 (match_operand:VI 2 "register_operand" "v")))]
1114 [(set_attr "type" "vecsimple")])
1116 (define_insn "xor<mode>3"
1117 [(set (match_operand:VI 0 "register_operand" "=v")
1118 (xor:VI (match_operand:VI 1 "register_operand" "v")
1119 (match_operand:VI 2 "register_operand" "v")))]
1122 [(set_attr "type" "vecsimple")])
1124 (define_insn "xorv4sf3"
1125 [(set (match_operand:V4SF 0 "register_operand" "=v")
1126 (xor:V4SF (match_operand:V4SF 1 "register_operand" "v")
1127 (match_operand:V4SF 2 "register_operand" "v")))]
1130 [(set_attr "type" "vecsimple")])
1132 (define_insn "one_cmpl<mode>2"
1133 [(set (match_operand:VI 0 "register_operand" "=v")
1134 (not:VI (match_operand:VI 1 "register_operand" "v")))]
1137 [(set_attr "type" "vecsimple")])
1139 (define_insn "altivec_nor<mode>3"
1140 [(set (match_operand:VI 0 "register_operand" "=v")
1141 (not:VI (ior:VI (match_operand:VI 1 "register_operand" "v")
1142 (match_operand:VI 2 "register_operand" "v"))))]
1145 [(set_attr "type" "vecsimple")])
1147 (define_insn "andc<mode>3"
1148 [(set (match_operand:VI 0 "register_operand" "=v")
1149 (and:VI (not:VI (match_operand:VI 2 "register_operand" "v"))
1150 (match_operand:VI 1 "register_operand" "v")))]
1153 [(set_attr "type" "vecsimple")])
1155 (define_insn "*andc3_v4sf"
1156 [(set (match_operand:V4SF 0 "register_operand" "=v")
1157 (and:V4SF (not:V4SF (match_operand:V4SF 2 "register_operand" "v"))
1158 (match_operand:V4SF 1 "register_operand" "v")))]
1161 [(set_attr "type" "vecsimple")])
1163 (define_insn "altivec_vpkuhum"
1164 [(set (match_operand:V16QI 0 "register_operand" "=v")
1165 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
1166 (match_operand:V8HI 2 "register_operand" "v")]
1170 [(set_attr "type" "vecperm")])
1172 (define_insn "altivec_vpkuwum"
1173 [(set (match_operand:V8HI 0 "register_operand" "=v")
1174 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
1175 (match_operand:V4SI 2 "register_operand" "v")]
1179 [(set_attr "type" "vecperm")])
1181 (define_insn "altivec_vpkpx"
1182 [(set (match_operand:V8HI 0 "register_operand" "=v")
1183 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
1184 (match_operand:V4SI 2 "register_operand" "v")]
1188 [(set_attr "type" "vecperm")])
1190 (define_insn "altivec_vpkshss"
1191 [(set (match_operand:V16QI 0 "register_operand" "=v")
1192 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
1193 (match_operand:V8HI 2 "register_operand" "v")]
1195 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1198 [(set_attr "type" "vecperm")])
1200 (define_insn "altivec_vpkswss"
1201 [(set (match_operand:V8HI 0 "register_operand" "=v")
1202 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
1203 (match_operand:V4SI 2 "register_operand" "v")]
1205 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1208 [(set_attr "type" "vecperm")])
1210 (define_insn "altivec_vpkuhus"
1211 [(set (match_operand:V16QI 0 "register_operand" "=v")
1212 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
1213 (match_operand:V8HI 2 "register_operand" "v")]
1215 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1218 [(set_attr "type" "vecperm")])
1220 (define_insn "altivec_vpkshus"
1221 [(set (match_operand:V16QI 0 "register_operand" "=v")
1222 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
1223 (match_operand:V8HI 2 "register_operand" "v")]
1225 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1228 [(set_attr "type" "vecperm")])
1230 (define_insn "altivec_vpkuwus"
1231 [(set (match_operand:V8HI 0 "register_operand" "=v")
1232 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
1233 (match_operand:V4SI 2 "register_operand" "v")]
1235 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1238 [(set_attr "type" "vecperm")])
1240 (define_insn "altivec_vpkswus"
1241 [(set (match_operand:V8HI 0 "register_operand" "=v")
1242 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
1243 (match_operand:V4SI 2 "register_operand" "v")]
1245 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1248 [(set_attr "type" "vecperm")])
1250 (define_insn "altivec_vrl<VI_char>"
1251 [(set (match_operand:VI 0 "register_operand" "=v")
1252 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
1253 (match_operand:VI 2 "register_operand" "v")]
1256 "vrl<VI_char> %0,%1,%2"
1257 [(set_attr "type" "vecsimple")])
1259 (define_insn "altivec_vsl"
1260 [(set (match_operand:V4SI 0 "register_operand" "=v")
1261 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1262 (match_operand:V4SI 2 "register_operand" "v")]
1266 [(set_attr "type" "vecperm")])
1268 (define_insn "altivec_vslo"
1269 [(set (match_operand:V4SI 0 "register_operand" "=v")
1270 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1271 (match_operand:V4SI 2 "register_operand" "v")]
1275 [(set_attr "type" "vecperm")])
1277 (define_insn "vashl<mode>3"
1278 [(set (match_operand:VI 0 "register_operand" "=v")
1279 (ashift:VI (match_operand:VI 1 "register_operand" "v")
1280 (match_operand:VI 2 "register_operand" "v") ))]
1282 "vsl<VI_char> %0,%1,%2"
1283 [(set_attr "type" "vecsimple")])
1285 (define_insn "vlshr<mode>3"
1286 [(set (match_operand:VI 0 "register_operand" "=v")
1287 (lshiftrt:VI (match_operand:VI 1 "register_operand" "v")
1288 (match_operand:VI 2 "register_operand" "v") ))]
1290 "vsr<VI_char> %0,%1,%2"
1291 [(set_attr "type" "vecsimple")])
1293 (define_insn "vashr<mode>3"
1294 [(set (match_operand:VI 0 "register_operand" "=v")
1295 (ashiftrt:VI (match_operand:VI 1 "register_operand" "v")
1296 (match_operand:VI 2 "register_operand" "v") ))]
1298 "vsra<VI_char> %0,%1,%2"
1299 [(set_attr "type" "vecsimple")])
1301 (define_insn "altivec_vsr"
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")]
1308 [(set_attr "type" "vecperm")])
1310 (define_insn "altivec_vsro"
1311 [(set (match_operand:V4SI 0 "register_operand" "=v")
1312 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1313 (match_operand:V4SI 2 "register_operand" "v")]
1317 [(set_attr "type" "vecperm")])
1319 (define_insn "altivec_vsum4ubs"
1320 [(set (match_operand:V4SI 0 "register_operand" "=v")
1321 (unspec:V4SI [(match_operand:V16QI 1 "register_operand" "v")
1322 (match_operand:V4SI 2 "register_operand" "v")]
1324 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1327 [(set_attr "type" "veccomplex")])
1329 (define_insn "altivec_vsum4s<VI_char>s"
1330 [(set (match_operand:V4SI 0 "register_operand" "=v")
1331 (unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v")
1332 (match_operand:V4SI 2 "register_operand" "v")]
1334 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1336 "vsum4s<VI_char>s %0,%1,%2"
1337 [(set_attr "type" "veccomplex")])
1339 (define_insn "altivec_vsum2sws"
1340 [(set (match_operand:V4SI 0 "register_operand" "=v")
1341 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1342 (match_operand:V4SI 2 "register_operand" "v")]
1344 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1347 [(set_attr "type" "veccomplex")])
1349 (define_insn "altivec_vsumsws"
1350 [(set (match_operand:V4SI 0 "register_operand" "=v")
1351 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1352 (match_operand:V4SI 2 "register_operand" "v")]
1354 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1357 [(set_attr "type" "veccomplex")])
1359 (define_insn "altivec_vspltb"
1360 [(set (match_operand:V16QI 0 "register_operand" "=v")
1361 (vec_duplicate:V16QI
1362 (vec_select:QI (match_operand:V16QI 1 "register_operand" "v")
1364 [(match_operand:QI 2 "u5bit_cint_operand" "")]))))]
1367 [(set_attr "type" "vecperm")])
1369 (define_insn "altivec_vsplth"
1370 [(set (match_operand:V8HI 0 "register_operand" "=v")
1372 (vec_select:HI (match_operand:V8HI 1 "register_operand" "v")
1374 [(match_operand:QI 2 "u5bit_cint_operand" "")]))))]
1377 [(set_attr "type" "vecperm")])
1379 (define_insn "altivec_vspltw"
1380 [(set (match_operand:V4SI 0 "register_operand" "=v")
1382 (vec_select:SI (match_operand:V4SI 1 "register_operand" "v")
1384 [(match_operand:QI 2 "u5bit_cint_operand" "i")]))))]
1387 [(set_attr "type" "vecperm")])
1389 (define_insn "*altivec_vspltsf"
1390 [(set (match_operand:V4SF 0 "register_operand" "=v")
1392 (vec_select:SF (match_operand:V4SF 1 "register_operand" "v")
1394 [(match_operand:QI 2 "u5bit_cint_operand" "i")]))))]
1397 [(set_attr "type" "vecperm")])
1399 (define_insn "altivec_vspltis<VI_char>"
1400 [(set (match_operand:VI 0 "register_operand" "=v")
1402 (match_operand:QI 1 "s5bit_cint_operand" "i")))]
1404 "vspltis<VI_char> %0,%1"
1405 [(set_attr "type" "vecperm")])
1407 (define_insn "ftruncv4sf2"
1408 [(set (match_operand:V4SF 0 "register_operand" "=v")
1409 (fix:V4SF (match_operand:V4SF 1 "register_operand" "v")))]
1412 [(set_attr "type" "vecfloat")])
1414 (define_insn "altivec_vperm_<mode>"
1415 [(set (match_operand:V 0 "register_operand" "=v")
1416 (unspec:V [(match_operand:V 1 "register_operand" "v")
1417 (match_operand:V 2 "register_operand" "v")
1418 (match_operand:V16QI 3 "register_operand" "v")]
1422 [(set_attr "type" "vecperm")])
1424 (define_insn "altivec_vrfip"
1425 [(set (match_operand:V4SF 0 "register_operand" "=v")
1426 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1430 [(set_attr "type" "vecfloat")])
1432 (define_insn "altivec_vrfin"
1433 [(set (match_operand:V4SF 0 "register_operand" "=v")
1434 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1438 [(set_attr "type" "vecfloat")])
1440 (define_insn "altivec_vrfim"
1441 [(set (match_operand:V4SF 0 "register_operand" "=v")
1442 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1446 [(set_attr "type" "vecfloat")])
1448 (define_insn "altivec_vcfux"
1449 [(set (match_operand:V4SF 0 "register_operand" "=v")
1450 (unspec:V4SF [(match_operand:V4SI 1 "register_operand" "v")
1451 (match_operand:QI 2 "immediate_operand" "i")]
1455 [(set_attr "type" "vecfloat")])
1457 (define_insn "altivec_vcfsx"
1458 [(set (match_operand:V4SF 0 "register_operand" "=v")
1459 (unspec:V4SF [(match_operand:V4SI 1 "register_operand" "v")
1460 (match_operand:QI 2 "immediate_operand" "i")]
1464 [(set_attr "type" "vecfloat")])
1466 (define_insn "altivec_vctuxs"
1467 [(set (match_operand:V4SI 0 "register_operand" "=v")
1468 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
1469 (match_operand:QI 2 "immediate_operand" "i")]
1471 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1474 [(set_attr "type" "vecfloat")])
1476 (define_insn "altivec_vctsxs"
1477 [(set (match_operand:V4SI 0 "register_operand" "=v")
1478 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
1479 (match_operand:QI 2 "immediate_operand" "i")]
1481 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1484 [(set_attr "type" "vecfloat")])
1486 (define_insn "altivec_vlogefp"
1487 [(set (match_operand:V4SF 0 "register_operand" "=v")
1488 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1492 [(set_attr "type" "vecfloat")])
1494 (define_insn "altivec_vexptefp"
1495 [(set (match_operand:V4SF 0 "register_operand" "=v")
1496 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1500 [(set_attr "type" "vecfloat")])
1502 (define_insn "altivec_vrsqrtefp"
1503 [(set (match_operand:V4SF 0 "register_operand" "=v")
1504 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1508 [(set_attr "type" "vecfloat")])
1510 (define_insn "altivec_vrefp"
1511 [(set (match_operand:V4SF 0 "register_operand" "=v")
1512 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
1516 [(set_attr "type" "vecfloat")])
1518 (define_expand "vcondv4si"
1519 [(set (match_operand:V4SI 0 "register_operand" "=v")
1521 (match_operator 3 "comparison_operator"
1522 [(match_operand:V4SI 4 "register_operand" "v")
1523 (match_operand:V4SI 5 "register_operand" "v")])
1524 (match_operand:V4SI 1 "register_operand" "v")
1525 (match_operand:V4SI 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 "vconduv4si"
1538 [(set (match_operand:V4SI 0 "register_operand" "=v")
1540 (match_operator 3 "comparison_operator"
1541 [(match_operand:V4SI 4 "register_operand" "v")
1542 (match_operand:V4SI 5 "register_operand" "v")])
1543 (match_operand:V4SI 1 "register_operand" "v")
1544 (match_operand:V4SI 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 "vcondv4sf"
1557 [(set (match_operand:V4SF 0 "register_operand" "=v")
1559 (match_operator 3 "comparison_operator"
1560 [(match_operand:V4SF 4 "register_operand" "v")
1561 (match_operand:V4SF 5 "register_operand" "v")])
1562 (match_operand:V4SF 1 "register_operand" "v")
1563 (match_operand:V4SF 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 "vcondv8hi"
1576 [(set (match_operand:V8HI 0 "register_operand" "=v")
1578 (match_operator 3 "comparison_operator"
1579 [(match_operand:V8HI 4 "register_operand" "v")
1580 (match_operand:V8HI 5 "register_operand" "v")])
1581 (match_operand:V8HI 1 "register_operand" "v")
1582 (match_operand:V8HI 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 "vconduv8hi"
1595 [(set (match_operand:V8HI 0 "register_operand" "=v")
1597 (match_operator 3 "comparison_operator"
1598 [(match_operand:V8HI 4 "register_operand" "v")
1599 (match_operand:V8HI 5 "register_operand" "v")])
1600 (match_operand:V8HI 1 "register_operand" "v")
1601 (match_operand:V8HI 2 "register_operand" "v")))]
1605 if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
1606 operands[3], operands[4], operands[5]))
1613 (define_expand "vcondv16qi"
1614 [(set (match_operand:V16QI 0 "register_operand" "=v")
1616 (match_operator 3 "comparison_operator"
1617 [(match_operand:V16QI 4 "register_operand" "v")
1618 (match_operand:V16QI 5 "register_operand" "v")])
1619 (match_operand:V16QI 1 "register_operand" "v")
1620 (match_operand:V16QI 2 "register_operand" "v")))]
1624 if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
1625 operands[3], operands[4], operands[5]))
1632 (define_expand "vconduv16qi"
1633 [(set (match_operand:V16QI 0 "register_operand" "=v")
1635 (match_operator 3 "comparison_operator"
1636 [(match_operand:V16QI 4 "register_operand" "v")
1637 (match_operand:V16QI 5 "register_operand" "v")])
1638 (match_operand:V16QI 1 "register_operand" "v")
1639 (match_operand:V16QI 2 "register_operand" "v")))]
1643 if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
1644 operands[3], operands[4], operands[5]))
1652 (define_insn "altivec_vsel_v4si"
1653 [(set (match_operand:V4SI 0 "register_operand" "=v")
1654 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1655 (match_operand:V4SI 2 "register_operand" "v")
1656 (match_operand:V4SI 3 "register_operand" "v")]
1660 [(set_attr "type" "vecperm")])
1662 (define_insn "altivec_vsel_v4sf"
1663 [(set (match_operand:V4SF 0 "register_operand" "=v")
1664 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")
1665 (match_operand:V4SF 2 "register_operand" "v")
1666 (match_operand:V4SI 3 "register_operand" "v")]
1670 [(set_attr "type" "vecperm")])
1672 (define_insn "altivec_vsel_v8hi"
1673 [(set (match_operand:V8HI 0 "register_operand" "=v")
1674 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
1675 (match_operand:V8HI 2 "register_operand" "v")
1676 (match_operand:V8HI 3 "register_operand" "v")]
1680 [(set_attr "type" "vecperm")])
1682 (define_insn "altivec_vsel_v16qi"
1683 [(set (match_operand:V16QI 0 "register_operand" "=v")
1684 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
1685 (match_operand:V16QI 2 "register_operand" "v")
1686 (match_operand:V16QI 3 "register_operand" "v")]
1690 [(set_attr "type" "vecperm")])
1692 (define_insn "altivec_vsldoi_<mode>"
1693 [(set (match_operand:V 0 "register_operand" "=v")
1694 (unspec:V [(match_operand:V 1 "register_operand" "v")
1695 (match_operand:V 2 "register_operand" "v")
1696 (match_operand:QI 3 "immediate_operand" "i")]
1699 "vsldoi %0,%1,%2,%3"
1700 [(set_attr "type" "vecperm")])
1702 (define_insn "altivec_vupkhsb"
1703 [(set (match_operand:V8HI 0 "register_operand" "=v")
1704 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
1708 [(set_attr "type" "vecperm")])
1710 (define_insn "altivec_vupkhpx"
1711 [(set (match_operand:V4SI 0 "register_operand" "=v")
1712 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
1716 [(set_attr "type" "vecperm")])
1718 (define_insn "altivec_vupkhsh"
1719 [(set (match_operand:V4SI 0 "register_operand" "=v")
1720 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
1724 [(set_attr "type" "vecperm")])
1726 (define_insn "altivec_vupklsb"
1727 [(set (match_operand:V8HI 0 "register_operand" "=v")
1728 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
1732 [(set_attr "type" "vecperm")])
1734 (define_insn "altivec_vupklpx"
1735 [(set (match_operand:V4SI 0 "register_operand" "=v")
1736 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
1740 [(set_attr "type" "vecperm")])
1742 (define_insn "altivec_vupklsh"
1743 [(set (match_operand:V4SI 0 "register_operand" "=v")
1744 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
1748 [(set_attr "type" "vecperm")])
1750 ;; AltiVec predicates.
1752 (define_expand "cr6_test_for_zero"
1753 [(set (match_operand:SI 0 "register_operand" "=r")
1759 (define_expand "cr6_test_for_zero_reverse"
1760 [(set (match_operand:SI 0 "register_operand" "=r")
1763 (set (match_dup 0) (minus:SI (const_int 1) (match_dup 0)))]
1767 (define_expand "cr6_test_for_lt"
1768 [(set (match_operand:SI 0 "register_operand" "=r")
1774 (define_expand "cr6_test_for_lt_reverse"
1775 [(set (match_operand:SI 0 "register_operand" "=r")
1778 (set (match_dup 0) (minus:SI (const_int 1) (match_dup 0)))]
1782 ;; We can get away with generating the opcode on the fly (%3 below)
1783 ;; because all the predicates have the same scheduling parameters.
1785 (define_insn "altivec_predicate_<mode>"
1787 (unspec:CC [(match_operand:V 1 "register_operand" "v")
1788 (match_operand:V 2 "register_operand" "v")
1789 (match_operand 3 "any_operand" "")] UNSPEC_PREDICATE))
1790 (clobber (match_scratch:V 0 "=v"))]
1793 [(set_attr "type" "veccmp")])
1795 (define_insn "altivec_mtvscr"
1798 [(match_operand:V4SI 0 "register_operand" "v")] UNSPECV_MTVSCR))]
1801 [(set_attr "type" "vecsimple")])
1803 (define_insn "altivec_mfvscr"
1804 [(set (match_operand:V8HI 0 "register_operand" "=v")
1805 (unspec_volatile:V8HI [(reg:SI 110)] UNSPECV_MFVSCR))]
1808 [(set_attr "type" "vecsimple")])
1810 (define_insn "altivec_dssall"
1811 [(unspec_volatile [(const_int 0)] UNSPECV_DSSALL)]
1814 [(set_attr "type" "vecsimple")])
1816 (define_insn "altivec_dss"
1817 [(unspec_volatile [(match_operand:QI 0 "immediate_operand" "i")]
1821 [(set_attr "type" "vecsimple")])
1823 (define_insn "altivec_dst"
1824 [(unspec [(match_operand 0 "register_operand" "b")
1825 (match_operand:SI 1 "register_operand" "r")
1826 (match_operand:QI 2 "immediate_operand" "i")] UNSPEC_DST)]
1827 "TARGET_ALTIVEC && GET_MODE (operands[0]) == Pmode"
1829 [(set_attr "type" "vecsimple")])
1831 (define_insn "altivec_dstt"
1832 [(unspec [(match_operand 0 "register_operand" "b")
1833 (match_operand:SI 1 "register_operand" "r")
1834 (match_operand:QI 2 "immediate_operand" "i")] UNSPEC_DSTT)]
1835 "TARGET_ALTIVEC && GET_MODE (operands[0]) == Pmode"
1837 [(set_attr "type" "vecsimple")])
1839 (define_insn "altivec_dstst"
1840 [(unspec [(match_operand 0 "register_operand" "b")
1841 (match_operand:SI 1 "register_operand" "r")
1842 (match_operand:QI 2 "immediate_operand" "i")] UNSPEC_DSTST)]
1843 "TARGET_ALTIVEC && GET_MODE (operands[0]) == Pmode"
1845 [(set_attr "type" "vecsimple")])
1847 (define_insn "altivec_dststt"
1848 [(unspec [(match_operand 0 "register_operand" "b")
1849 (match_operand:SI 1 "register_operand" "r")
1850 (match_operand:QI 2 "immediate_operand" "i")] UNSPEC_DSTSTT)]
1851 "TARGET_ALTIVEC && GET_MODE (operands[0]) == Pmode"
1853 [(set_attr "type" "vecsimple")])
1855 (define_insn "altivec_lvsl"
1856 [(set (match_operand:V16QI 0 "register_operand" "=v")
1857 (unspec:V16QI [(match_operand 1 "memory_operand" "Z")] UNSPEC_LVSL))]
1860 [(set_attr "type" "vecload")])
1862 (define_insn "altivec_lvsr"
1863 [(set (match_operand:V16QI 0 "register_operand" "=v")
1864 (unspec:V16QI [(match_operand 1 "memory_operand" "Z")] UNSPEC_LVSR))]
1867 [(set_attr "type" "vecload")])
1869 (define_expand "build_vector_mask_for_load"
1870 [(set (match_operand:V16QI 0 "register_operand" "")
1871 (unspec:V16QI [(match_operand 1 "memory_operand" "")] UNSPEC_LVSR))]
1878 gcc_assert (GET_CODE (operands[1]) == MEM);
1880 addr = XEXP (operands[1], 0);
1881 temp = gen_reg_rtx (GET_MODE (addr));
1882 emit_insn (gen_rtx_SET (VOIDmode, temp,
1883 gen_rtx_NEG (GET_MODE (addr), addr)));
1884 emit_insn (gen_altivec_lvsr (operands[0],
1885 replace_equiv_address (operands[1], temp)));
1889 ;; Parallel some of the LVE* and STV*'s with unspecs because some have
1890 ;; identical rtl but different instructions-- and gcc gets confused.
1892 (define_insn "altivec_lve<VI_char>x"
1894 [(set (match_operand:VI 0 "register_operand" "=v")
1895 (match_operand:VI 1 "memory_operand" "Z"))
1896 (unspec [(const_int 0)] UNSPEC_LVE)])]
1898 "lve<VI_char>x %0,%y1"
1899 [(set_attr "type" "vecload")])
1901 (define_insn "*altivec_lvesfx"
1903 [(set (match_operand:V4SF 0 "register_operand" "=v")
1904 (match_operand:V4SF 1 "memory_operand" "Z"))
1905 (unspec [(const_int 0)] UNSPEC_LVE)])]
1908 [(set_attr "type" "vecload")])
1910 (define_insn "altivec_lvxl"
1912 [(set (match_operand:V4SI 0 "register_operand" "=v")
1913 (match_operand:V4SI 1 "memory_operand" "Z"))
1914 (unspec [(const_int 0)] UNSPEC_SET_VSCR)])]
1917 [(set_attr "type" "vecload")])
1919 (define_insn "altivec_lvx"
1920 [(set (match_operand:V4SI 0 "register_operand" "=v")
1921 (match_operand:V4SI 1 "memory_operand" "Z"))]
1924 [(set_attr "type" "vecload")])
1926 (define_insn "altivec_stvx"
1928 [(set (match_operand:V4SI 0 "memory_operand" "=Z")
1929 (match_operand:V4SI 1 "register_operand" "v"))
1930 (unspec [(const_int 0)] UNSPEC_STVX)])]
1933 [(set_attr "type" "vecstore")])
1935 (define_insn "altivec_stvxl"
1937 [(set (match_operand:V4SI 0 "memory_operand" "=Z")
1938 (match_operand:V4SI 1 "register_operand" "v"))
1939 (unspec [(const_int 0)] UNSPEC_STVXL)])]
1942 [(set_attr "type" "vecstore")])
1944 (define_insn "altivec_stve<VI_char>x"
1946 [(set (match_operand:VI 0 "memory_operand" "=Z")
1947 (match_operand:VI 1 "register_operand" "v"))
1948 (unspec [(const_int 0)] UNSPEC_STVE)])]
1950 "stve<VI_char>x %1,%y0"
1951 [(set_attr "type" "vecstore")])
1953 (define_insn "*altivec_stvesfx"
1955 [(set (match_operand:V4SF 0 "memory_operand" "=Z")
1956 (match_operand:V4SF 1 "register_operand" "v"))
1957 (unspec [(const_int 0)] UNSPEC_STVE)])]
1960 [(set_attr "type" "vecstore")])
1962 (define_expand "vec_init<mode>"
1963 [(match_operand:V 0 "register_operand" "")
1964 (match_operand 1 "" "")]
1967 rs6000_expand_vector_init (operands[0], operands[1]);
1971 (define_expand "vec_setv4si"
1972 [(match_operand:V4SI 0 "register_operand" "")
1973 (match_operand:SI 1 "register_operand" "")
1974 (match_operand 2 "const_int_operand" "")]
1977 rs6000_expand_vector_set (operands[0], operands[1], INTVAL (operands[2]));
1981 (define_expand "vec_setv8hi"
1982 [(match_operand:V8HI 0 "register_operand" "")
1983 (match_operand:HI 1 "register_operand" "")
1984 (match_operand 2 "const_int_operand" "")]
1987 rs6000_expand_vector_set (operands[0], operands[1], INTVAL (operands[2]));
1991 (define_expand "vec_setv16qi"
1992 [(match_operand:V16QI 0 "register_operand" "")
1993 (match_operand:QI 1 "register_operand" "")
1994 (match_operand 2 "const_int_operand" "")]
1997 rs6000_expand_vector_set (operands[0], operands[1], INTVAL (operands[2]));
2001 (define_expand "vec_setv4sf"
2002 [(match_operand:V4SF 0 "register_operand" "")
2003 (match_operand:SF 1 "register_operand" "")
2004 (match_operand 2 "const_int_operand" "")]
2007 rs6000_expand_vector_set (operands[0], operands[1], INTVAL (operands[2]));
2011 (define_expand "vec_extractv4si"
2012 [(match_operand:SI 0 "register_operand" "")
2013 (match_operand:V4SI 1 "register_operand" "")
2014 (match_operand 2 "const_int_operand" "")]
2017 rs6000_expand_vector_extract (operands[0], operands[1], INTVAL (operands[2]));
2021 (define_expand "vec_extractv8hi"
2022 [(match_operand:HI 0 "register_operand" "")
2023 (match_operand:V8HI 1 "register_operand" "")
2024 (match_operand 2 "const_int_operand" "")]
2027 rs6000_expand_vector_extract (operands[0], operands[1], INTVAL (operands[2]));
2031 (define_expand "vec_extractv16qi"
2032 [(match_operand:QI 0 "register_operand" "")
2033 (match_operand:V16QI 1 "register_operand" "")
2034 (match_operand 2 "const_int_operand" "")]
2037 rs6000_expand_vector_extract (operands[0], operands[1], INTVAL (operands[2]));
2041 (define_expand "vec_extractv4sf"
2042 [(match_operand:SF 0 "register_operand" "")
2043 (match_operand:V4SF 1 "register_operand" "")
2044 (match_operand 2 "const_int_operand" "")]
2047 rs6000_expand_vector_extract (operands[0], operands[1], INTVAL (operands[2]));
2052 ;; vspltis? SCRATCH0,0
2053 ;; vsubu?m SCRATCH2,SCRATCH1,%1
2054 ;; vmaxs? %0,%1,SCRATCH2"
2055 (define_expand "abs<mode>2"
2056 [(set (match_dup 2) (vec_duplicate:VI (const_int 0)))
2058 (minus:VI (match_dup 2)
2059 (match_operand:VI 1 "register_operand" "v")))
2060 (set (match_operand:VI 0 "register_operand" "=v")
2061 (smax:VI (match_dup 1) (match_dup 3)))]
2064 operands[2] = gen_reg_rtx (GET_MODE (operands[0]));
2065 operands[3] = gen_reg_rtx (GET_MODE (operands[0]));
2069 ;; vspltisw SCRATCH1,-1
2070 ;; vslw SCRATCH2,SCRATCH1,SCRATCH1
2071 ;; vandc %0,%1,SCRATCH2
2072 (define_expand "absv4sf2"
2074 (vec_duplicate:V4SI (const_int -1)))
2076 (ashift:V4SI (match_dup 2) (match_dup 2)))
2077 (set (match_operand:V4SF 0 "register_operand" "=v")
2078 (and:V4SF (not:V4SF (subreg:V4SF (match_dup 3) 0))
2079 (match_operand:V4SF 1 "register_operand" "v")))]
2082 operands[2] = gen_reg_rtx (V4SImode);
2083 operands[3] = gen_reg_rtx (V4SImode);
2087 ;; vspltis? SCRATCH0,0
2088 ;; vsubs?s SCRATCH2,SCRATCH1,%1
2089 ;; vmaxs? %0,%1,SCRATCH2"
2090 (define_expand "altivec_abss_<mode>"
2091 [(set (match_dup 2) (vec_duplicate:VI (const_int 0)))
2092 (parallel [(set (match_dup 3)
2093 (unspec:VI [(match_dup 2)
2094 (match_operand:VI 1 "register_operand" "v")]
2096 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))])
2097 (set (match_operand:VI 0 "register_operand" "=v")
2098 (smax:VI (match_dup 1) (match_dup 3)))]
2101 operands[2] = gen_reg_rtx (GET_MODE (operands[0]));
2102 operands[3] = gen_reg_rtx (GET_MODE (operands[0]));
2105 ;; Vector shift left in bits. Currently supported ony for shift
2106 ;; amounts that can be expressed as byte shifts (divisible by 8).
2107 ;; General shift amounts can be supported using vslo + vsl. We're
2108 ;; not expecting to see these yet (the vectorizer currently
2109 ;; generates only shifts divisible by byte_size).
2110 (define_expand "vec_shl_<mode>"
2111 [(set (match_operand:V 0 "register_operand" "=v")
2112 (unspec:V [(match_operand:V 1 "register_operand" "v")
2113 (match_operand:QI 2 "reg_or_short_operand" "")]
2118 rtx bitshift = operands[2];
2119 rtx byteshift = gen_reg_rtx (QImode);
2120 HOST_WIDE_INT bitshift_val;
2121 HOST_WIDE_INT byteshift_val;
2123 if (! CONSTANT_P (bitshift))
2125 bitshift_val = INTVAL (bitshift);
2126 if (bitshift_val & 0x7)
2128 byteshift_val = bitshift_val >> 3;
2129 byteshift = gen_rtx_CONST_INT (QImode, byteshift_val);
2130 emit_insn (gen_altivec_vsldoi_<mode> (operands[0], operands[1], operands[1],
2135 ;; Vector shift left in bits. Currently supported ony for shift
2136 ;; amounts that can be expressed as byte shifts (divisible by 8).
2137 ;; General shift amounts can be supported using vsro + vsr. We're
2138 ;; not expecting to see these yet (the vectorizer currently
2139 ;; generates only shifts divisible by byte_size).
2140 (define_expand "vec_shr_<mode>"
2141 [(set (match_operand:V 0 "register_operand" "=v")
2142 (unspec:V [(match_operand:V 1 "register_operand" "v")
2143 (match_operand:QI 2 "reg_or_short_operand" "")]
2148 rtx bitshift = operands[2];
2149 rtx byteshift = gen_reg_rtx (QImode);
2150 HOST_WIDE_INT bitshift_val;
2151 HOST_WIDE_INT byteshift_val;
2153 if (! CONSTANT_P (bitshift))
2155 bitshift_val = INTVAL (bitshift);
2156 if (bitshift_val & 0x7)
2158 byteshift_val = 16 - (bitshift_val >> 3);
2159 byteshift = gen_rtx_CONST_INT (QImode, byteshift_val);
2160 emit_insn (gen_altivec_vsldoi_<mode> (operands[0], operands[1], operands[1],
2165 (define_insn "altivec_vsumsws_nomode"
2166 [(set (match_operand 0 "register_operand" "=v")
2167 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
2168 (match_operand:V4SI 2 "register_operand" "v")]
2170 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
2173 [(set_attr "type" "veccomplex")])
2175 (define_expand "reduc_splus_<mode>"
2176 [(set (match_operand:VIshort 0 "register_operand" "=v")
2177 (unspec:VIshort [(match_operand:VIshort 1 "register_operand" "v")]
2178 UNSPEC_REDUC_PLUS))]
2182 rtx vzero = gen_reg_rtx (V4SImode);
2183 rtx vtmp1 = gen_reg_rtx (V4SImode);
2185 emit_insn (gen_altivec_vspltisw (vzero, const0_rtx));
2186 emit_insn (gen_altivec_vsum4s<VI_char>s (vtmp1, operands[1], vzero));
2187 emit_insn (gen_altivec_vsumsws_nomode (operands[0], vtmp1, vzero));
2191 (define_expand "reduc_uplus_v16qi"
2192 [(set (match_operand:V16QI 0 "register_operand" "=v")
2193 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")]
2194 UNSPEC_REDUC_PLUS))]
2198 rtx vzero = gen_reg_rtx (V4SImode);
2199 rtx vtmp1 = gen_reg_rtx (V4SImode);
2201 emit_insn (gen_altivec_vspltisw (vzero, const0_rtx));
2202 emit_insn (gen_altivec_vsum4ubs (vtmp1, operands[1], vzero));
2203 emit_insn (gen_altivec_vsumsws_nomode (operands[0], vtmp1, vzero));
2207 (define_insn "vec_realign_load_<mode>"
2208 [(set (match_operand:V 0 "register_operand" "=v")
2209 (unspec:V [(match_operand:V 1 "register_operand" "v")
2210 (match_operand:V 2 "register_operand" "v")
2211 (match_operand:V16QI 3 "register_operand" "v")]
2212 UNSPEC_REALIGN_LOAD))]
2215 [(set_attr "type" "vecperm")])
2217 (define_expand "neg<mode>2"
2218 [(use (match_operand:VI 0 "register_operand" ""))
2219 (use (match_operand:VI 1 "register_operand" ""))]
2225 vzero = gen_reg_rtx (GET_MODE (operands[0]));
2226 emit_insn (gen_altivec_vspltis<VI_char> (vzero, const0_rtx));
2227 emit_insn (gen_sub<mode>3 (operands[0], vzero, operands[1]));
2232 (define_expand "udot_prod<mode>"
2233 [(set (match_operand:V4SI 0 "register_operand" "=v")
2234 (plus:V4SI (match_operand:V4SI 3 "register_operand" "v")
2235 (unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v")
2236 (match_operand:VIshort 2 "register_operand" "v")]
2241 emit_insn (gen_altivec_vmsumu<VI_char>m (operands[0], operands[1], operands[2], operands[3]));
2245 (define_expand "sdot_prodv8hi"
2246 [(set (match_operand:V4SI 0 "register_operand" "=v")
2247 (plus:V4SI (match_operand:V4SI 3 "register_operand" "v")
2248 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
2249 (match_operand:V8HI 2 "register_operand" "v")]
2254 emit_insn (gen_altivec_vmsumshm (operands[0], operands[1], operands[2], operands[3]));
2258 (define_expand "widen_usum<mode>3"
2259 [(set (match_operand:V4SI 0 "register_operand" "=v")
2260 (plus:V4SI (match_operand:V4SI 2 "register_operand" "v")
2261 (unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v")]
2266 rtx vones = gen_reg_rtx (GET_MODE (operands[1]));
2268 emit_insn (gen_altivec_vspltis<VI_char> (vones, const1_rtx));
2269 emit_insn (gen_altivec_vmsumu<VI_char>m (operands[0], operands[1], vones, operands[2]));
2273 (define_expand "widen_ssumv16qi3"
2274 [(set (match_operand:V4SI 0 "register_operand" "=v")
2275 (plus:V4SI (match_operand:V4SI 2 "register_operand" "v")
2276 (unspec:V4SI [(match_operand:V16QI 1 "register_operand" "v")]
2281 rtx vones = gen_reg_rtx (V16QImode);
2283 emit_insn (gen_altivec_vspltisb (vones, const1_rtx));
2284 emit_insn (gen_altivec_vmsummbm (operands[0], operands[1], vones, operands[2]));
2288 (define_expand "widen_ssumv8hi3"
2289 [(set (match_operand:V4SI 0 "register_operand" "=v")
2290 (plus:V4SI (match_operand:V4SI 2 "register_operand" "v")
2291 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
2296 rtx vones = gen_reg_rtx (V8HImode);
2298 emit_insn (gen_altivec_vspltish (vones, const1_rtx));
2299 emit_insn (gen_altivec_vmsumshm (operands[0], operands[1], vones, operands[2]));
2303 (define_expand "vec_unpacks_hi_v16qi"
2304 [(set (match_operand:V8HI 0 "register_operand" "=v")
2305 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
2310 emit_insn (gen_altivec_vupkhsb (operands[0], operands[1]));
2314 (define_expand "vec_unpacks_hi_v8hi"
2315 [(set (match_operand:V4SI 0 "register_operand" "=v")
2316 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
2321 emit_insn (gen_altivec_vupkhsh (operands[0], operands[1]));
2325 (define_expand "vec_unpacks_lo_v16qi"
2326 [(set (match_operand:V8HI 0 "register_operand" "=v")
2327 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
2332 emit_insn (gen_altivec_vupklsb (operands[0], operands[1]));
2336 (define_expand "vec_unpacks_lo_v8hi"
2337 [(set (match_operand:V4SI 0 "register_operand" "=v")
2338 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
2343 emit_insn (gen_altivec_vupklsh (operands[0], operands[1]));
2347 (define_insn "vperm_v8hiv4si"
2348 [(set (match_operand:V4SI 0 "register_operand" "=v")
2349 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
2350 (match_operand:V4SI 2 "register_operand" "v")
2351 (match_operand:V16QI 3 "register_operand" "v")]
2355 [(set_attr "type" "vecperm")])
2357 (define_insn "vperm_v16qiv8hi"
2358 [(set (match_operand:V8HI 0 "register_operand" "=v")
2359 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
2360 (match_operand:V8HI 2 "register_operand" "v")
2361 (match_operand:V16QI 3 "register_operand" "v")]
2365 [(set_attr "type" "vecperm")])
2368 (define_expand "vec_unpacku_hi_v16qi"
2369 [(set (match_operand:V8HI 0 "register_operand" "=v")
2370 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
2375 rtx vzero = gen_reg_rtx (V8HImode);
2376 rtx mask = gen_reg_rtx (V16QImode);
2377 rtvec v = rtvec_alloc (16);
2379 emit_insn (gen_altivec_vspltish (vzero, const0_rtx));
2381 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16);
2382 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 0);
2383 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 16);
2384 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 1);
2385 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16);
2386 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 2);
2387 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 16);
2388 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 3);
2389 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2390 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 4);
2391 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 16);
2392 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 5);
2393 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16);
2394 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 6);
2395 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 16);
2396 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 7);
2398 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2399 emit_insn (gen_vperm_v16qiv8hi (operands[0], operands[1], vzero, mask));
2403 (define_expand "vec_unpacku_hi_v8hi"
2404 [(set (match_operand:V4SI 0 "register_operand" "=v")
2405 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
2410 rtx vzero = gen_reg_rtx (V4SImode);
2411 rtx mask = gen_reg_rtx (V16QImode);
2412 rtvec v = rtvec_alloc (16);
2414 emit_insn (gen_altivec_vspltisw (vzero, const0_rtx));
2416 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16);
2417 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 17);
2418 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 0);
2419 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 1);
2420 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16);
2421 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 17);
2422 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 2);
2423 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 3);
2424 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2425 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 17);
2426 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 4);
2427 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 5);
2428 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16);
2429 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 17);
2430 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 6);
2431 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 7);
2433 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2434 emit_insn (gen_vperm_v8hiv4si (operands[0], operands[1], vzero, mask));
2438 (define_expand "vec_unpacku_lo_v16qi"
2439 [(set (match_operand:V8HI 0 "register_operand" "=v")
2440 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
2445 rtx vzero = gen_reg_rtx (V8HImode);
2446 rtx mask = gen_reg_rtx (V16QImode);
2447 rtvec v = rtvec_alloc (16);
2449 emit_insn (gen_altivec_vspltish (vzero, const0_rtx));
2451 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16);
2452 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 8);
2453 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 16);
2454 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 9);
2455 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16);
2456 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 10);
2457 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 16);
2458 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 11);
2459 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2460 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 12);
2461 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 16);
2462 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 13);
2463 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16);
2464 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 14);
2465 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 16);
2466 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 15);
2468 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2469 emit_insn (gen_vperm_v16qiv8hi (operands[0], operands[1], vzero, mask));
2473 (define_expand "vec_unpacku_lo_v8hi"
2474 [(set (match_operand:V4SI 0 "register_operand" "=v")
2475 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
2480 rtx vzero = gen_reg_rtx (V4SImode);
2481 rtx mask = gen_reg_rtx (V16QImode);
2482 rtvec v = rtvec_alloc (16);
2484 emit_insn (gen_altivec_vspltisw (vzero, const0_rtx));
2486 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16);
2487 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 17);
2488 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 8);
2489 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 9);
2490 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16);
2491 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 17);
2492 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 10);
2493 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 11);
2494 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2495 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 17);
2496 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 12);
2497 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 13);
2498 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16);
2499 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 17);
2500 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 14);
2501 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 15);
2503 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2504 emit_insn (gen_vperm_v8hiv4si (operands[0], operands[1], vzero, mask));
2508 (define_expand "vec_widen_umult_hi_v16qi"
2509 [(set (match_operand:V8HI 0 "register_operand" "=v")
2510 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
2511 (match_operand:V16QI 2 "register_operand" "v")]
2516 rtx ve = gen_reg_rtx (V8HImode);
2517 rtx vo = gen_reg_rtx (V8HImode);
2519 emit_insn (gen_altivec_vmuleub (ve, operands[1], operands[2]));
2520 emit_insn (gen_altivec_vmuloub (vo, operands[1], operands[2]));
2521 emit_insn (gen_altivec_vmrghh (operands[0], ve, vo));
2525 (define_expand "vec_widen_umult_lo_v16qi"
2526 [(set (match_operand:V8HI 0 "register_operand" "=v")
2527 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
2528 (match_operand:V16QI 2 "register_operand" "v")]
2533 rtx ve = gen_reg_rtx (V8HImode);
2534 rtx vo = gen_reg_rtx (V8HImode);
2536 emit_insn (gen_altivec_vmuleub (ve, operands[1], operands[2]));
2537 emit_insn (gen_altivec_vmuloub (vo, operands[1], operands[2]));
2538 emit_insn (gen_altivec_vmrglh (operands[0], ve, vo));
2542 (define_expand "vec_widen_smult_hi_v16qi"
2543 [(set (match_operand:V8HI 0 "register_operand" "=v")
2544 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
2545 (match_operand:V16QI 2 "register_operand" "v")]
2550 rtx ve = gen_reg_rtx (V8HImode);
2551 rtx vo = gen_reg_rtx (V8HImode);
2553 emit_insn (gen_altivec_vmulesb (ve, operands[1], operands[2]));
2554 emit_insn (gen_altivec_vmulosb (vo, operands[1], operands[2]));
2555 emit_insn (gen_altivec_vmrghh (operands[0], ve, vo));
2559 (define_expand "vec_widen_smult_lo_v16qi"
2560 [(set (match_operand:V8HI 0 "register_operand" "=v")
2561 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
2562 (match_operand:V16QI 2 "register_operand" "v")]
2567 rtx ve = gen_reg_rtx (V8HImode);
2568 rtx vo = gen_reg_rtx (V8HImode);
2570 emit_insn (gen_altivec_vmulesb (ve, operands[1], operands[2]));
2571 emit_insn (gen_altivec_vmulosb (vo, operands[1], operands[2]));
2572 emit_insn (gen_altivec_vmrglh (operands[0], ve, vo));
2576 (define_expand "vec_widen_umult_hi_v8hi"
2577 [(set (match_operand:V4SI 0 "register_operand" "=v")
2578 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
2579 (match_operand:V8HI 2 "register_operand" "v")]
2584 rtx ve = gen_reg_rtx (V4SImode);
2585 rtx vo = gen_reg_rtx (V4SImode);
2587 emit_insn (gen_altivec_vmuleuh (ve, operands[1], operands[2]));
2588 emit_insn (gen_altivec_vmulouh (vo, operands[1], operands[2]));
2589 emit_insn (gen_altivec_vmrghw (operands[0], ve, vo));
2593 (define_expand "vec_widen_umult_lo_v8hi"
2594 [(set (match_operand:V4SI 0 "register_operand" "=v")
2595 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
2596 (match_operand:V8HI 2 "register_operand" "v")]
2601 rtx ve = gen_reg_rtx (V4SImode);
2602 rtx vo = gen_reg_rtx (V4SImode);
2604 emit_insn (gen_altivec_vmuleuh (ve, operands[1], operands[2]));
2605 emit_insn (gen_altivec_vmulouh (vo, operands[1], operands[2]));
2606 emit_insn (gen_altivec_vmrglw (operands[0], ve, vo));
2610 (define_expand "vec_widen_smult_hi_v8hi"
2611 [(set (match_operand:V4SI 0 "register_operand" "=v")
2612 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
2613 (match_operand:V8HI 2 "register_operand" "v")]
2618 rtx ve = gen_reg_rtx (V4SImode);
2619 rtx vo = gen_reg_rtx (V4SImode);
2621 emit_insn (gen_altivec_vmulesh (ve, operands[1], operands[2]));
2622 emit_insn (gen_altivec_vmulosh (vo, operands[1], operands[2]));
2623 emit_insn (gen_altivec_vmrghw (operands[0], ve, vo));
2627 (define_expand "vec_widen_smult_lo_v8hi"
2628 [(set (match_operand:V4SI 0 "register_operand" "=v")
2629 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
2630 (match_operand:V8HI 2 "register_operand" "v")]
2635 rtx ve = gen_reg_rtx (V4SImode);
2636 rtx vo = gen_reg_rtx (V4SImode);
2638 emit_insn (gen_altivec_vmulesh (ve, operands[1], operands[2]));
2639 emit_insn (gen_altivec_vmulosh (vo, operands[1], operands[2]));
2640 emit_insn (gen_altivec_vmrglw (operands[0], ve, vo));
2644 (define_expand "vec_pack_trunc_v8hi"
2645 [(set (match_operand:V16QI 0 "register_operand" "=v")
2646 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
2647 (match_operand:V8HI 2 "register_operand" "v")]
2652 emit_insn (gen_altivec_vpkuhum (operands[0], operands[1], operands[2]));
2656 (define_expand "vec_pack_trunc_v4si"
2657 [(set (match_operand:V8HI 0 "register_operand" "=v")
2658 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
2659 (match_operand:V4SI 2 "register_operand" "v")]
2664 emit_insn (gen_altivec_vpkuwum (operands[0], operands[1], operands[2]));
2668 (define_expand "negv4sf2"
2669 [(use (match_operand:V4SF 0 "register_operand" ""))
2670 (use (match_operand:V4SF 1 "register_operand" ""))]
2676 /* Generate [-0.0, -0.0, -0.0, -0.0]. */
2677 neg0 = gen_reg_rtx (V4SImode);
2678 emit_insn (gen_altivec_vspltisw (neg0, constm1_rtx));
2679 emit_insn (gen_vashlv4si3 (neg0, neg0, neg0));
2682 emit_insn (gen_xorv4sf3 (operands[0],
2683 gen_lowpart (V4SFmode, neg0), operands[1]));
2688 ;; Vector SIMD PEM v2.06c defines LVLX, LVLXL, LVRX, LVRXL,
2689 ;; STVLX, STVLXL, STVVRX, STVRXL are available only on Cell.
2690 (define_insn "altivec_lvlx"
2691 [(set (match_operand:V16QI 0 "register_operand" "=v")
2692 (unspec:V16QI [(match_operand 1 "memory_operand" "Z")]
2694 "TARGET_ALTIVEC && rs6000_cpu == PROCESSOR_CELL"
2696 [(set_attr "type" "vecload")])
2698 (define_insn "altivec_lvlxl"
2699 [(set (match_operand:V16QI 0 "register_operand" "=v")
2700 (unspec:V16QI [(match_operand 1 "memory_operand" "Z")]
2702 "TARGET_ALTIVEC && rs6000_cpu == PROCESSOR_CELL"
2704 [(set_attr "type" "vecload")])
2706 (define_insn "altivec_lvrx"
2707 [(set (match_operand:V16QI 0 "register_operand" "=v")
2708 (unspec:V16QI [(match_operand 1 "memory_operand" "Z")]
2710 "TARGET_ALTIVEC && rs6000_cpu == PROCESSOR_CELL"
2712 [(set_attr "type" "vecload")])
2714 (define_insn "altivec_lvrxl"
2715 [(set (match_operand:V16QI 0 "register_operand" "=v")
2716 (unspec:V16QI [(match_operand 1 "memory_operand" "Z")]
2718 "TARGET_ALTIVEC && rs6000_cpu == PROCESSOR_CELL"
2720 [(set_attr "type" "vecload")])
2722 (define_insn "altivec_stvlx"
2724 [(set (match_operand:V4SI 0 "memory_operand" "=Z")
2725 (match_operand:V4SI 1 "register_operand" "v"))
2726 (unspec [(const_int 0)] UNSPEC_STVLX)])]
2727 "TARGET_ALTIVEC && rs6000_cpu == PROCESSOR_CELL"
2729 [(set_attr "type" "vecstore")])
2731 (define_insn "altivec_stvlxl"
2733 [(set (match_operand:V4SI 0 "memory_operand" "=Z")
2734 (match_operand:V4SI 1 "register_operand" "v"))
2735 (unspec [(const_int 0)] UNSPEC_STVLXL)])]
2736 "TARGET_ALTIVEC && rs6000_cpu == PROCESSOR_CELL"
2738 [(set_attr "type" "vecstore")])
2740 (define_insn "altivec_stvrx"
2742 [(set (match_operand:V4SI 0 "memory_operand" "=Z")
2743 (match_operand:V4SI 1 "register_operand" "v"))
2744 (unspec [(const_int 0)] UNSPEC_STVRX)])]
2745 "TARGET_ALTIVEC && rs6000_cpu == PROCESSOR_CELL"
2747 [(set_attr "type" "vecstore")])
2749 (define_insn "altivec_stvrxl"
2751 [(set (match_operand:V4SI 0 "memory_operand" "=Z")
2752 (match_operand:V4SI 1 "register_operand" "v"))
2753 (unspec [(const_int 0)] UNSPEC_STVRXL)])]
2754 "TARGET_ALTIVEC && rs6000_cpu == PROCESSOR_CELL"
2756 [(set_attr "type" "vecstore")])
2758 (define_expand "vec_extract_evenv4si"
2759 [(set (match_operand:V4SI 0 "register_operand" "")
2760 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "")
2761 (match_operand:V4SI 2 "register_operand" "")]
2762 UNSPEC_EXTEVEN_V4SI))]
2766 rtx mask = gen_reg_rtx (V16QImode);
2767 rtvec v = rtvec_alloc (16);
2769 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 0);
2770 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 1);
2771 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 2);
2772 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 3);
2773 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 8);
2774 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 9);
2775 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 10);
2776 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 11);
2777 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2778 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 17);
2779 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 18);
2780 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 19);
2781 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 24);
2782 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 25);
2783 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 26);
2784 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 27);
2785 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2786 emit_insn (gen_altivec_vperm_v4si (operands[0], operands[1], operands[2], mask));
2791 (define_expand "vec_extract_evenv4sf"
2792 [(set (match_operand:V4SF 0 "register_operand" "")
2793 (unspec:V8HI [(match_operand:V4SF 1 "register_operand" "")
2794 (match_operand:V4SF 2 "register_operand" "")]
2795 UNSPEC_EXTEVEN_V4SF))]
2799 rtx mask = gen_reg_rtx (V16QImode);
2800 rtvec v = rtvec_alloc (16);
2802 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 0);
2803 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 1);
2804 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 2);
2805 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 3);
2806 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 8);
2807 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 9);
2808 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 10);
2809 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 11);
2810 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2811 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 17);
2812 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 18);
2813 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 19);
2814 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 24);
2815 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 25);
2816 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 26);
2817 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 27);
2818 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2819 emit_insn (gen_altivec_vperm_v4sf (operands[0], operands[1], operands[2], mask));
2824 (define_expand "vec_extract_evenv8hi"
2825 [(set (match_operand:V4SI 0 "register_operand" "")
2826 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "")
2827 (match_operand:V8HI 2 "register_operand" "")]
2828 UNSPEC_EXTEVEN_V8HI))]
2832 rtx mask = gen_reg_rtx (V16QImode);
2833 rtvec v = rtvec_alloc (16);
2835 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 0);
2836 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 1);
2837 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 4);
2838 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 5);
2839 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 8);
2840 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 9);
2841 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 12);
2842 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 13);
2843 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2844 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 17);
2845 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 20);
2846 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 21);
2847 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 24);
2848 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 25);
2849 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 28);
2850 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 29);
2851 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2852 emit_insn (gen_altivec_vperm_v8hi (operands[0], operands[1], operands[2], mask));
2857 (define_expand "vec_extract_evenv16qi"
2858 [(set (match_operand:V4SI 0 "register_operand" "")
2859 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "")
2860 (match_operand:V16QI 2 "register_operand" "")]
2861 UNSPEC_EXTEVEN_V16QI))]
2865 rtx mask = gen_reg_rtx (V16QImode);
2866 rtvec v = rtvec_alloc (16);
2868 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 0);
2869 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 2);
2870 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 4);
2871 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 6);
2872 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 8);
2873 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 10);
2874 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 12);
2875 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 14);
2876 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
2877 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 18);
2878 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 20);
2879 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 22);
2880 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 24);
2881 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 26);
2882 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 28);
2883 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 30);
2884 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2885 emit_insn (gen_altivec_vperm_v16qi (operands[0], operands[1], operands[2], mask));
2890 (define_expand "vec_extract_oddv4si"
2891 [(set (match_operand:V4SI 0 "register_operand" "")
2892 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "")
2893 (match_operand:V4SI 2 "register_operand" "")]
2894 UNSPEC_EXTODD_V4SI))]
2898 rtx mask = gen_reg_rtx (V16QImode);
2899 rtvec v = rtvec_alloc (16);
2901 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 4);
2902 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 5);
2903 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 6);
2904 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 7);
2905 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 12);
2906 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 13);
2907 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 14);
2908 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 15);
2909 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 20);
2910 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 21);
2911 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 22);
2912 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 23);
2913 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 28);
2914 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 29);
2915 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 30);
2916 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 31);
2917 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2918 emit_insn (gen_altivec_vperm_v4si (operands[0], operands[1], operands[2], mask));
2923 (define_expand "vec_extract_oddv4sf"
2924 [(set (match_operand:V4SF 0 "register_operand" "")
2925 (unspec:V8HI [(match_operand:V4SF 1 "register_operand" "")
2926 (match_operand:V4SF 2 "register_operand" "")]
2927 UNSPEC_EXTODD_V4SF))]
2931 rtx mask = gen_reg_rtx (V16QImode);
2932 rtvec v = rtvec_alloc (16);
2934 RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 4);
2935 RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 5);
2936 RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 6);
2937 RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 7);
2938 RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 12);
2939 RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 13);
2940 RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 14);
2941 RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 15);
2942 RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 20);
2943 RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 21);
2944 RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 22);
2945 RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 23);
2946 RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 28);
2947 RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 29);
2948 RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 30);
2949 RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 31);
2950 emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
2951 emit_insn (gen_altivec_vperm_v4sf (operands[0], operands[1], operands[2], mask));
2956 (define_insn "vpkuhum_nomode"
2957 [(set (match_operand:V16QI 0 "register_operand" "=v")
2958 (unspec:V16QI [(match_operand 1 "register_operand" "v")
2959 (match_operand 2 "register_operand" "v")]
2963 [(set_attr "type" "vecperm")])
2965 (define_insn "vpkuwum_nomode"
2966 [(set (match_operand:V8HI 0 "register_operand" "=v")
2967 (unspec:V8HI [(match_operand 1 "register_operand" "v")
2968 (match_operand 2 "register_operand" "v")]
2972 [(set_attr "type" "vecperm")])
2974 (define_expand "vec_extract_oddv8hi"
2975 [(set (match_operand:V8HI 0 "register_operand" "")
2976 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "")
2977 (match_operand:V8HI 2 "register_operand" "")]
2978 UNSPEC_EXTODD_V8HI))]
2982 emit_insn (gen_vpkuwum_nomode (operands[0], operands[1], operands[2]));
2986 (define_expand "vec_extract_oddv16qi"
2987 [(set (match_operand:V16QI 0 "register_operand" "")
2988 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "")
2989 (match_operand:V16QI 2 "register_operand" "")]
2990 UNSPEC_EXTODD_V16QI))]
2994 emit_insn (gen_vpkuhum_nomode (operands[0], operands[1], operands[2]));
2997 (define_expand "vec_interleave_highv4sf"
2998 [(set (match_operand:V4SF 0 "register_operand" "")
2999 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "")
3000 (match_operand:V4SF 2 "register_operand" "")]
3001 UNSPEC_INTERHI_V4SF))]
3005 emit_insn (gen_altivec_vmrghsf (operands[0], operands[1], operands[2]));
3009 (define_expand "vec_interleave_lowv4sf"
3010 [(set (match_operand:V4SF 0 "register_operand" "")
3011 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "")
3012 (match_operand:V4SF 2 "register_operand" "")]
3013 UNSPEC_INTERLO_V4SF))]
3017 emit_insn (gen_altivec_vmrglsf (operands[0], operands[1], operands[2]));
3021 (define_expand "vec_interleave_high<mode>"
3022 [(set (match_operand:VI 0 "register_operand" "")
3023 (unspec:VI [(match_operand:VI 1 "register_operand" "")
3024 (match_operand:VI 2 "register_operand" "")]
3029 emit_insn (gen_altivec_vmrgh<VI_char> (operands[0], operands[1], operands[2]));
3033 (define_expand "vec_interleave_low<mode>"
3034 [(set (match_operand:VI 0 "register_operand" "")
3035 (unspec:VI [(match_operand:VI 1 "register_operand" "")
3036 (match_operand:VI 2 "register_operand" "")]
3041 emit_insn (gen_altivec_vmrgl<VI_char> (operands[0], operands[1], operands[2]));
3045 (define_expand "vec_unpacks_float_hi_v8hi"
3046 [(set (match_operand:V4SF 0 "register_operand" "")
3047 (unspec:V4SF [(match_operand:V8HI 1 "register_operand" "")]
3048 UNSPEC_VUPKHS_V4SF))]
3052 rtx tmp = gen_reg_rtx (V4SImode);
3054 emit_insn (gen_vec_unpacks_hi_v8hi (tmp, operands[1]));
3055 emit_insn (gen_altivec_vcfsx (operands[0], tmp, const0_rtx));
3059 (define_expand "vec_unpacks_float_lo_v8hi"
3060 [(set (match_operand:V4SF 0 "register_operand" "")
3061 (unspec:V4SF [(match_operand:V8HI 1 "register_operand" "")]
3062 UNSPEC_VUPKLS_V4SF))]
3066 rtx tmp = gen_reg_rtx (V4SImode);
3068 emit_insn (gen_vec_unpacks_lo_v8hi (tmp, operands[1]));
3069 emit_insn (gen_altivec_vcfsx (operands[0], tmp, const0_rtx));
3073 (define_expand "vec_unpacku_float_hi_v8hi"
3074 [(set (match_operand:V4SF 0 "register_operand" "")
3075 (unspec:V4SF [(match_operand:V8HI 1 "register_operand" "")]
3076 UNSPEC_VUPKHU_V4SF))]
3080 rtx tmp = gen_reg_rtx (V4SImode);
3082 emit_insn (gen_vec_unpacku_hi_v8hi (tmp, operands[1]));
3083 emit_insn (gen_altivec_vcfux (operands[0], tmp, const0_rtx));
3087 (define_expand "vec_unpacku_float_lo_v8hi"
3088 [(set (match_operand:V4SF 0 "register_operand" "")
3089 (unspec:V4SF [(match_operand:V8HI 1 "register_operand" "")]
3090 UNSPEC_VUPKLU_V4SF))]
3094 rtx tmp = gen_reg_rtx (V4SImode);
3096 emit_insn (gen_vec_unpacku_lo_v8hi (tmp, operands[1]));
3097 emit_insn (gen_altivec_vcfux (operands[0], tmp, const0_rtx));