2 ;; Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
3 ;; Contributed by Aldy Hernandez (aldy@quesejoda.com)
5 ;; This file is part of GCC.
7 ;; GCC is free software; you can redistribute it and/or modify it
8 ;; under the terms of the GNU General Public License as published
9 ;; by the Free Software Foundation; either version 2, or (at your
10 ;; option) any later version.
12 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
13 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 ;; License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GCC; see the file COPYING. If not, write to the
19 ;; Free Software Foundation, 59 Temple Place - Suite 330, Boston,
20 ;; MA 02111-1307, USA.
43 (UNSPEC_VCOND_V4SI 301)
44 (UNSPEC_VCOND_V4SF 302)
45 (UNSPEC_VCOND_V8HI 303)
46 (UNSPEC_VCOND_V16QI 304)
47 (UNSPEC_VCONDU_V4SI 305)
48 (UNSPEC_VCONDU_V8HI 306)
49 (UNSPEC_VCONDU_V16QI 307)
53 (define_mode_macro VI [V4SI V8HI V16QI])
55 (define_mode_macro VIshort [V8HI V16QI])
57 (define_mode_macro VF [V4SF])
58 ;; Vec modes, pity mode macros are not composable
59 (define_mode_macro V [V4SI V8HI V16QI V4SF])
61 (define_mode_attr VI_char [(V4SI "w") (V8HI "h") (V16QI "b")])
63 ;; Generic LVX load instruction.
64 (define_insn "altivec_lvx_<mode>"
65 [(set (match_operand:V 0 "altivec_register_operand" "=v")
66 (match_operand:V 1 "memory_operand" "m"))]
69 [(set_attr "type" "vecload")])
71 ;; Generic STVX store instruction.
72 (define_insn "altivec_stvx_<mode>"
73 [(set (match_operand:V 0 "memory_operand" "=m")
74 (match_operand:V 1 "altivec_register_operand" "v"))]
77 [(set_attr "type" "vecstore")])
79 ;; Vector move instructions.
80 (define_expand "mov<mode>"
81 [(set (match_operand:V 0 "nonimmediate_operand" "")
82 (match_operand:V 1 "any_operand" ""))]
85 rs6000_emit_move (operands[0], operands[1], <MODE>mode);
89 (define_insn "*mov<mode>_internal"
90 [(set (match_operand:V 0 "nonimmediate_operand" "=m,v,v,o,r,r,v")
91 (match_operand:V 1 "input_operand" "v,m,v,r,o,r,W"))]
93 && (register_operand (operands[0], <MODE>mode)
94 || register_operand (operands[1], <MODE>mode))"
96 switch (which_alternative)
98 case 0: return "stvx %1,%y0";
99 case 1: return "lvx %0,%y1";
100 case 2: return "vor %0,%1,%1";
104 case 6: return output_vec_const_move (operands);
105 default: gcc_unreachable ();
108 [(set_attr "type" "vecstore,vecload,vecsimple,store,load,*,*")])
111 [(set (match_operand:V4SI 0 "nonimmediate_operand" "")
112 (match_operand:V4SI 1 "input_operand" ""))]
113 "TARGET_ALTIVEC && reload_completed
114 && gpr_or_gpr_p (operands[0], operands[1])"
117 rs6000_split_multireg_move (operands[0], operands[1]); DONE;
121 [(set (match_operand:V4SI 0 "altivec_register_operand" "")
122 (match_operand:V4SI 1 "easy_vector_constant_add_self" ""))]
123 "TARGET_ALTIVEC && reload_completed"
124 [(set (match_dup 0) (match_dup 3))
126 (plus:V4SI (match_dup 0)
129 operands[3] = gen_easy_vector_constant_add_self (operands[1]);
133 [(set (match_operand:V8HI 0 "nonimmediate_operand" "")
134 (match_operand:V8HI 1 "input_operand" ""))]
135 "TARGET_ALTIVEC && reload_completed
136 && gpr_or_gpr_p (operands[0], operands[1])"
138 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
141 [(set (match_operand:V8HI 0 "altivec_register_operand" "")
142 (match_operand:V8HI 1 "easy_vector_constant_add_self" ""))]
143 "TARGET_ALTIVEC && reload_completed"
144 [(set (match_dup 0) (match_dup 3))
146 (plus:V8HI (match_dup 0)
149 operands[3] = gen_easy_vector_constant_add_self (operands[1]);
153 [(set (match_operand:V16QI 0 "nonimmediate_operand" "")
154 (match_operand:V16QI 1 "input_operand" ""))]
155 "TARGET_ALTIVEC && reload_completed
156 && gpr_or_gpr_p (operands[0], operands[1])"
158 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
161 [(set (match_operand:V16QI 0 "altivec_register_operand" "")
162 (match_operand:V16QI 1 "easy_vector_constant_add_self" ""))]
163 "TARGET_ALTIVEC && reload_completed"
164 [(set (match_dup 0) (match_dup 3))
166 (plus:V16QI (match_dup 0)
169 operands[3] = gen_easy_vector_constant_add_self (operands[1]);
173 [(set (match_operand:V4SF 0 "nonimmediate_operand" "")
174 (match_operand:V4SF 1 "input_operand" ""))]
175 "TARGET_ALTIVEC && reload_completed
176 && gpr_or_gpr_p (operands[0], operands[1])"
179 rs6000_split_multireg_move (operands[0], operands[1]); DONE;
182 (define_insn "get_vrsave_internal"
183 [(set (match_operand:SI 0 "register_operand" "=r")
184 (unspec:SI [(reg:SI 109)] 214))]
188 return "mfspr %0,256";
190 return "mfvrsave %0";
192 [(set_attr "type" "*")])
194 (define_insn "*set_vrsave_internal"
195 [(match_parallel 0 "vrsave_operation"
197 (unspec_volatile:SI [(match_operand:SI 1 "register_operand" "r")
198 (reg:SI 109)] 30))])]
202 return "mtspr 256,%1";
204 return "mtvrsave %1";
206 [(set_attr "type" "*")])
208 (define_insn "*save_world"
209 [(match_parallel 0 "save_world_operation"
210 [(clobber (match_operand:SI 1 "register_operand" "=l"))
211 (use (match_operand:SI 2 "call_operand" "s"))])]
212 "TARGET_MACHO && (DEFAULT_ABI == ABI_DARWIN) && TARGET_32BIT"
214 [(set_attr "type" "branch")
215 (set_attr "length" "4")])
217 (define_insn "*restore_world"
218 [(match_parallel 0 "restore_world_operation"
220 (use (match_operand:SI 1 "register_operand" "l"))
221 (use (match_operand:SI 2 "call_operand" "s"))
222 (clobber (match_operand:SI 3 "gpc_reg_operand" "=r"))])]
223 "TARGET_MACHO && (DEFAULT_ABI == ABI_DARWIN) && TARGET_32BIT"
226 ;; Simple binary operations.
229 (define_insn "add<mode>3"
230 [(set (match_operand:VI 0 "register_operand" "=v")
231 (plus:VI (match_operand:VI 1 "register_operand" "v")
232 (match_operand:VI 2 "register_operand" "v")))]
234 "vaddu<VI_char>m %0,%1,%2"
235 [(set_attr "type" "vecsimple")])
237 (define_insn "addv4sf3"
238 [(set (match_operand:V4SF 0 "register_operand" "=v")
239 (plus:V4SF (match_operand:V4SF 1 "register_operand" "v")
240 (match_operand:V4SF 2 "register_operand" "v")))]
243 [(set_attr "type" "vecfloat")])
245 (define_insn "altivec_vaddcuw"
246 [(set (match_operand:V4SI 0 "register_operand" "=v")
247 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
248 (match_operand:V4SI 2 "register_operand" "v")] 35))]
251 [(set_attr "type" "vecsimple")])
253 (define_insn "altivec_vaddu<VI_char>s"
254 [(set (match_operand:VI 0 "register_operand" "=v")
255 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
256 (match_operand:VI 2 "register_operand" "v")] 36))
257 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
259 "vaddu<VI_char>s %0,%1,%2"
260 [(set_attr "type" "vecsimple")])
262 (define_insn "altivec_vadds<VI_char>s"
263 [(set (match_operand:VI 0 "register_operand" "=v")
264 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
265 (match_operand:VI 2 "register_operand" "v")] 37))
266 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
268 "vadds<VI_char>s %0,%1,%2"
269 [(set_attr "type" "vecsimple")])
272 (define_insn "sub<mode>3"
273 [(set (match_operand:VI 0 "register_operand" "=v")
274 (minus:VI (match_operand:VI 1 "register_operand" "v")
275 (match_operand:VI 2 "register_operand" "v")))]
277 "vsubu<VI_char>m %0,%1,%2"
278 [(set_attr "type" "vecsimple")])
280 (define_insn "subv4sf3"
281 [(set (match_operand:V4SF 0 "register_operand" "=v")
282 (minus:V4SF (match_operand:V4SF 1 "register_operand" "v")
283 (match_operand:V4SF 2 "register_operand" "v")))]
286 [(set_attr "type" "vecfloat")])
288 (define_insn "altivec_vsubcuw"
289 [(set (match_operand:V4SI 0 "register_operand" "=v")
290 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
291 (match_operand:V4SI 2 "register_operand" "v")] 124))]
294 [(set_attr "type" "vecsimple")])
296 (define_insn "altivec_vsubu<VI_char>s"
297 [(set (match_operand:VI 0 "register_operand" "=v")
298 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
299 (match_operand:VI 2 "register_operand" "v")] 125))
300 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
302 "vsubu<VI_char>s %0,%1,%2"
303 [(set_attr "type" "vecsimple")])
305 (define_insn "altivec_vsubs<VI_char>s"
306 [(set (match_operand:VI 0 "register_operand" "=v")
307 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
308 (match_operand:VI 2 "register_operand" "v")] UNSPEC_SUBS))
309 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
311 "vsubs<VI_char>s %0,%1,%2"
312 [(set_attr "type" "vecsimple")])
315 (define_insn "altivec_vavgu<VI_char>"
316 [(set (match_operand:VI 0 "register_operand" "=v")
317 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
318 (match_operand:VI 2 "register_operand" "v")] 44))]
320 "vavgu<VI_char> %0,%1,%2"
321 [(set_attr "type" "vecsimple")])
323 (define_insn "altivec_vavgs<VI_char>"
324 [(set (match_operand:VI 0 "register_operand" "=v")
325 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
326 (match_operand:VI 2 "register_operand" "v")] 45))]
328 "vavgs<VI_char> %0,%1,%2"
329 [(set_attr "type" "vecsimple")])
331 (define_insn "altivec_vcmpbfp"
332 [(set (match_operand:V4SI 0 "register_operand" "=v")
333 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
334 (match_operand:V4SF 2 "register_operand" "v")]
338 [(set_attr "type" "veccmp")])
340 (define_insn "altivec_vcmpequb"
341 [(set (match_operand:V16QI 0 "register_operand" "=v")
342 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
343 (match_operand:V16QI 2 "register_operand" "v")]
347 [(set_attr "type" "vecsimple")])
349 (define_insn "altivec_vcmpequh"
350 [(set (match_operand:V8HI 0 "register_operand" "=v")
351 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
352 (match_operand:V8HI 2 "register_operand" "v")]
356 [(set_attr "type" "vecsimple")])
358 (define_insn "altivec_vcmpequw"
359 [(set (match_operand:V4SI 0 "register_operand" "=v")
360 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
361 (match_operand:V4SI 2 "register_operand" "v")]
365 [(set_attr "type" "vecsimple")])
367 (define_insn "altivec_vcmpeqfp"
368 [(set (match_operand:V4SI 0 "register_operand" "=v")
369 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
370 (match_operand:V4SF 2 "register_operand" "v")]
374 [(set_attr "type" "veccmp")])
376 (define_insn "altivec_vcmpgefp"
377 [(set (match_operand:V4SI 0 "register_operand" "=v")
378 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
379 (match_operand:V4SF 2 "register_operand" "v")]
383 [(set_attr "type" "veccmp")])
385 (define_insn "altivec_vcmpgtub"
386 [(set (match_operand:V16QI 0 "register_operand" "=v")
387 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
388 (match_operand:V16QI 2 "register_operand" "v")]
392 [(set_attr "type" "vecsimple")])
394 (define_insn "altivec_vcmpgtsb"
395 [(set (match_operand:V16QI 0 "register_operand" "=v")
396 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
397 (match_operand:V16QI 2 "register_operand" "v")]
401 [(set_attr "type" "vecsimple")])
403 (define_insn "altivec_vcmpgtuh"
404 [(set (match_operand:V8HI 0 "register_operand" "=v")
405 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
406 (match_operand:V8HI 2 "register_operand" "v")]
410 [(set_attr "type" "vecsimple")])
412 (define_insn "altivec_vcmpgtsh"
413 [(set (match_operand:V8HI 0 "register_operand" "=v")
414 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
415 (match_operand:V8HI 2 "register_operand" "v")]
419 [(set_attr "type" "vecsimple")])
421 (define_insn "altivec_vcmpgtuw"
422 [(set (match_operand:V4SI 0 "register_operand" "=v")
423 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
424 (match_operand:V4SI 2 "register_operand" "v")]
428 [(set_attr "type" "vecsimple")])
430 (define_insn "altivec_vcmpgtsw"
431 [(set (match_operand:V4SI 0 "register_operand" "=v")
432 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
433 (match_operand:V4SI 2 "register_operand" "v")]
437 [(set_attr "type" "vecsimple")])
439 (define_insn "altivec_vcmpgtfp"
440 [(set (match_operand:V4SI 0 "register_operand" "=v")
441 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
442 (match_operand:V4SF 2 "register_operand" "v")]
446 [(set_attr "type" "veccmp")])
448 ;; Fused multiply add
449 (define_insn "altivec_vmaddfp"
450 [(set (match_operand:V4SF 0 "register_operand" "=v")
451 (plus:V4SF (mult:V4SF (match_operand:V4SF 1 "register_operand" "v")
452 (match_operand:V4SF 2 "register_operand" "v"))
453 (match_operand:V4SF 3 "register_operand" "v")))]
455 "vmaddfp %0,%1,%2,%3"
456 [(set_attr "type" "vecfloat")])
458 ;; We do multiply as a fused multiply-add with an add of a -0.0 vector.
460 (define_expand "mulv4sf3"
461 [(use (match_operand:V4SF 0 "register_operand" ""))
462 (use (match_operand:V4SF 1 "register_operand" ""))
463 (use (match_operand:V4SF 2 "register_operand" ""))]
464 "TARGET_ALTIVEC && TARGET_FUSED_MADD"
469 /* Generate [-0.0, -0.0, -0.0, -0.0]. */
470 neg0 = gen_reg_rtx (V4SFmode);
471 emit_insn (gen_altivec_vspltisw_v4sf (neg0, constm1_rtx));
472 emit_insn (gen_altivec_vslw_v4sf (neg0, neg0, neg0));
474 /* Use the multiply-add. */
475 emit_insn (gen_altivec_vmaddfp (operands[0], operands[1], operands[2],
480 ;; 32 bit integer multiplication
481 ;; A_high = Operand_0 & 0xFFFF0000 >> 16
482 ;; A_low = Operand_0 & 0xFFFF
483 ;; B_high = Operand_1 & 0xFFFF0000 >> 16
484 ;; B_low = Operand_1 & 0xFFFF
485 ;; result = A_low * B_low + (A_high * B_low + B_high * A_low) << 16
487 ;; (define_insn "mulv4si3"
488 ;; [(set (match_operand:V4SI 0 "register_operand" "=v")
489 ;; (mult:V4SI (match_operand:V4SI 1 "register_operand" "v")
490 ;; (match_operand:V4SI 2 "register_operand" "v")))]
491 (define_expand "mulv4si3"
492 [(use (match_operand:V4SI 0 "register_operand" ""))
493 (use (match_operand:V4SI 1 "register_operand" ""))
494 (use (match_operand:V4SI 2 "register_operand" ""))]
507 zero = gen_reg_rtx (V4SImode);
508 emit_insn (gen_altivec_vspltisw (zero, const0_rtx));
510 sixteen = gen_reg_rtx (V4SImode);
511 emit_insn (gen_altivec_vspltisw (sixteen, gen_rtx_CONST_INT (V4SImode, -16)));
513 swap = gen_reg_rtx (V4SImode);
514 emit_insn (gen_altivec_vrlw (swap, operands[2], sixteen));
516 one = gen_reg_rtx (V8HImode);
517 convert_move (one, operands[1], 0);
519 two = gen_reg_rtx (V8HImode);
520 convert_move (two, operands[2], 0);
522 small_swap = gen_reg_rtx (V8HImode);
523 convert_move (small_swap, swap, 0);
525 low_product = gen_reg_rtx (V4SImode);
526 emit_insn (gen_altivec_vmulouh (low_product, one, two));
528 high_product = gen_reg_rtx (V4SImode);
529 emit_insn (gen_altivec_vmsumuhm (high_product, one, small_swap, zero));
531 emit_insn (gen_altivec_vslw (high_product, high_product, sixteen));
533 emit_insn (gen_addv4si3 (operands[0], high_product, low_product));
539 ;; Fused multiply subtract
540 (define_insn "altivec_vnmsubfp"
541 [(set (match_operand:V4SF 0 "register_operand" "=v")
542 (neg:V4SF (minus:V4SF (mult:V4SF (match_operand:V4SF 1 "register_operand" "v")
543 (match_operand:V4SF 2 "register_operand" "v"))
544 (match_operand:V4SF 3 "register_operand" "v"))))]
546 "vnmsubfp %0,%1,%2,%3"
547 [(set_attr "type" "vecfloat")])
549 (define_insn "altivec_vmsumu<VI_char>m"
550 [(set (match_operand:V4SI 0 "register_operand" "=v")
551 (unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v")
552 (match_operand:VIshort 2 "register_operand" "v")
553 (match_operand:V4SI 3 "register_operand" "v")] 65))]
555 "vmsumu<VI_char>m %0,%1,%2,%3"
556 [(set_attr "type" "veccomplex")])
558 (define_insn "altivec_vmsumm<VI_char>m"
559 [(set (match_operand:V4SI 0 "register_operand" "=v")
560 (unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v")
561 (match_operand:VIshort 2 "register_operand" "v")
562 (match_operand:V4SI 3 "register_operand" "v")] 66))]
564 "vmsumm<VI_char>m %0,%1,%2,%3"
565 [(set_attr "type" "veccomplex")])
567 (define_insn "altivec_vmsumshm"
568 [(set (match_operand:V4SI 0 "register_operand" "=v")
569 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
570 (match_operand:V8HI 2 "register_operand" "v")
571 (match_operand:V4SI 3 "register_operand" "v")] 68))]
573 "vmsumshm %0,%1,%2,%3"
574 [(set_attr "type" "veccomplex")])
576 (define_insn "altivec_vmsumuhs"
577 [(set (match_operand:V4SI 0 "register_operand" "=v")
578 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
579 (match_operand:V8HI 2 "register_operand" "v")
580 (match_operand:V4SI 3 "register_operand" "v")] 69))
581 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
583 "vmsumuhs %0,%1,%2,%3"
584 [(set_attr "type" "veccomplex")])
586 (define_insn "altivec_vmsumshs"
587 [(set (match_operand:V4SI 0 "register_operand" "=v")
588 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
589 (match_operand:V8HI 2 "register_operand" "v")
590 (match_operand:V4SI 3 "register_operand" "v")] 70))
591 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
593 "vmsumshs %0,%1,%2,%3"
594 [(set_attr "type" "veccomplex")])
598 (define_insn "umax<mode>3"
599 [(set (match_operand:VI 0 "register_operand" "=v")
600 (umax:VI (match_operand:VI 1 "register_operand" "v")
601 (match_operand:VI 2 "register_operand" "v")))]
603 "vmaxu<VI_char> %0,%1,%2"
604 [(set_attr "type" "vecsimple")])
606 (define_insn "smax<mode>3"
607 [(set (match_operand:VI 0 "register_operand" "=v")
608 (smax:VI (match_operand:VI 1 "register_operand" "v")
609 (match_operand:VI 2 "register_operand" "v")))]
611 "vmaxs<VI_char> %0,%1,%2"
612 [(set_attr "type" "vecsimple")])
614 (define_insn "smaxv4sf3"
615 [(set (match_operand:V4SF 0 "register_operand" "=v")
616 (smax:V4SF (match_operand:V4SF 1 "register_operand" "v")
617 (match_operand:V4SF 2 "register_operand" "v")))]
620 [(set_attr "type" "veccmp")])
622 (define_insn "umin<mode>3"
623 [(set (match_operand:VI 0 "register_operand" "=v")
624 (umin:VI (match_operand:VI 1 "register_operand" "v")
625 (match_operand:VI 2 "register_operand" "v")))]
627 "vminu<VI_char> %0,%1,%2"
628 [(set_attr "type" "vecsimple")])
630 (define_insn "smin<mode>3"
631 [(set (match_operand:VI 0 "register_operand" "=v")
632 (smin:VI (match_operand:VI 1 "register_operand" "v")
633 (match_operand:VI 2 "register_operand" "v")))]
635 "vmins<VI_char> %0,%1,%2"
636 [(set_attr "type" "vecsimple")])
638 (define_insn "sminv4sf3"
639 [(set (match_operand:V4SF 0 "register_operand" "=v")
640 (smin:V4SF (match_operand:V4SF 1 "register_operand" "v")
641 (match_operand:V4SF 2 "register_operand" "v")))]
644 [(set_attr "type" "veccmp")])
646 (define_insn "altivec_vmhaddshs"
647 [(set (match_operand:V8HI 0 "register_operand" "=v")
648 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
649 (match_operand:V8HI 2 "register_operand" "v")
650 (match_operand:V8HI 3 "register_operand" "v")] 71))
651 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
653 "vmhaddshs %0,%1,%2,%3"
654 [(set_attr "type" "veccomplex")])
655 (define_insn "altivec_vmhraddshs"
656 [(set (match_operand:V8HI 0 "register_operand" "=v")
657 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
658 (match_operand:V8HI 2 "register_operand" "v")
659 (match_operand:V8HI 3 "register_operand" "v")] 72))
660 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
662 "vmhraddshs %0,%1,%2,%3"
663 [(set_attr "type" "veccomplex")])
664 (define_insn "altivec_vmladduhm"
665 [(set (match_operand:V8HI 0 "register_operand" "=v")
666 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
667 (match_operand:V8HI 2 "register_operand" "v")
668 (match_operand:V8HI 3 "register_operand" "v")] 73))]
670 "vmladduhm %0,%1,%2,%3"
671 [(set_attr "type" "veccomplex")])
673 (define_insn "altivec_vmrghb"
674 [(set (match_operand:V16QI 0 "register_operand" "=v")
675 (vec_merge:V16QI (vec_select:V16QI (match_operand:V16QI 1 "register_operand" "v")
676 (parallel [(const_int 8)
692 (match_operand:V16QI 2 "register_operand" "v")
696 [(set_attr "type" "vecperm")])
698 (define_insn "altivec_vmrghh"
699 [(set (match_operand:V8HI 0 "register_operand" "=v")
700 (vec_merge:V8HI (vec_select:V8HI (match_operand:V8HI 1 "register_operand" "v")
701 (parallel [(const_int 4)
709 (match_operand:V8HI 2 "register_operand" "v")
713 [(set_attr "type" "vecperm")])
715 (define_insn "altivec_vmrghw"
716 [(set (match_operand:V4SI 0 "register_operand" "=v")
717 (vec_merge:V4SI (vec_select:V4SI (match_operand:V4SI 1 "register_operand" "v")
718 (parallel [(const_int 2)
722 (match_operand:V4SI 2 "register_operand" "v")
726 [(set_attr "type" "vecperm")])
728 (define_insn "altivec_vmrglb"
729 [(set (match_operand:V16QI 0 "register_operand" "=v")
730 (vec_merge:V16QI (vec_select:V16QI (match_operand:V16QI 2 "register_operand" "v")
731 (parallel [(const_int 0)
747 (match_operand:V16QI 1 "register_operand" "v")
751 [(set_attr "type" "vecperm")])
753 (define_insn "altivec_vmrglh"
754 [(set (match_operand:V8HI 0 "register_operand" "=v")
755 (vec_merge:V8HI (vec_select:V8HI (match_operand:V8HI 2 "register_operand" "v")
756 (parallel [(const_int 0)
764 (match_operand:V8HI 1 "register_operand" "v")
768 [(set_attr "type" "vecperm")])
770 (define_insn "altivec_vmrglw"
771 [(set (match_operand:V4SI 0 "register_operand" "=v")
772 (vec_merge:V4SI (vec_select:V4SI (match_operand:V4SI 2 "register_operand" "v")
773 (parallel [(const_int 0)
777 (match_operand:V4SI 1 "register_operand" "v")
781 [(set_attr "type" "vecperm")])
783 (define_insn "altivec_vmuleub"
784 [(set (match_operand:V8HI 0 "register_operand" "=v")
785 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
786 (match_operand:V16QI 2 "register_operand" "v")] 83))]
789 [(set_attr "type" "veccomplex")])
791 (define_insn "altivec_vmulesb"
792 [(set (match_operand:V8HI 0 "register_operand" "=v")
793 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
794 (match_operand:V16QI 2 "register_operand" "v")] 84))]
797 [(set_attr "type" "veccomplex")])
799 (define_insn "altivec_vmuleuh"
800 [(set (match_operand:V4SI 0 "register_operand" "=v")
801 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
802 (match_operand:V8HI 2 "register_operand" "v")] 85))]
805 [(set_attr "type" "veccomplex")])
807 (define_insn "altivec_vmulesh"
808 [(set (match_operand:V4SI 0 "register_operand" "=v")
809 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
810 (match_operand:V8HI 2 "register_operand" "v")] 86))]
813 [(set_attr "type" "veccomplex")])
815 (define_insn "altivec_vmuloub"
816 [(set (match_operand:V8HI 0 "register_operand" "=v")
817 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
818 (match_operand:V16QI 2 "register_operand" "v")] 87))]
821 [(set_attr "type" "veccomplex")])
823 (define_insn "altivec_vmulosb"
824 [(set (match_operand:V8HI 0 "register_operand" "=v")
825 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
826 (match_operand:V16QI 2 "register_operand" "v")] 88))]
829 [(set_attr "type" "veccomplex")])
831 (define_insn "altivec_vmulouh"
832 [(set (match_operand:V4SI 0 "register_operand" "=v")
833 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
834 (match_operand:V8HI 2 "register_operand" "v")] 89))]
837 [(set_attr "type" "veccomplex")])
839 (define_insn "altivec_vmulosh"
840 [(set (match_operand:V4SI 0 "register_operand" "=v")
841 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
842 (match_operand:V8HI 2 "register_operand" "v")] 90))]
845 [(set_attr "type" "veccomplex")])
850 (define_insn "and<mode>3"
851 [(set (match_operand:VI 0 "register_operand" "=v")
852 (and:VI (match_operand:VI 1 "register_operand" "v")
853 (match_operand:VI 2 "register_operand" "v")))]
856 [(set_attr "type" "vecsimple")])
858 (define_insn "ior<mode>3"
859 [(set (match_operand:VI 0 "register_operand" "=v")
860 (ior:VI (match_operand:VI 1 "register_operand" "v")
861 (match_operand:VI 2 "register_operand" "v")))]
864 [(set_attr "type" "vecsimple")])
866 (define_insn "xor<mode>3"
867 [(set (match_operand:VI 0 "register_operand" "=v")
868 (xor:VI (match_operand:VI 1 "register_operand" "v")
869 (match_operand:VI 2 "register_operand" "v")))]
872 [(set_attr "type" "vecsimple")])
874 (define_insn "one_cmpl<mode>2"
875 [(set (match_operand:VI 0 "register_operand" "=v")
876 (not:VI (match_operand:VI 1 "register_operand" "v")))]
879 [(set_attr "type" "vecsimple")])
881 (define_insn "altivec_nor<mode>3"
882 [(set (match_operand:VI 0 "register_operand" "=v")
883 (not:VI (ior:VI (match_operand:VI 1 "register_operand" "v")
884 (match_operand:VI 2 "register_operand" "v"))))]
887 [(set_attr "type" "vecsimple")])
889 (define_insn "andc<mode>3"
890 [(set (match_operand:VI 0 "register_operand" "=v")
891 (and:VI (not:VI (match_operand:VI 2 "register_operand" "v"))
892 (match_operand:VI 1 "register_operand" "v")))]
895 [(set_attr "type" "vecsimple")])
897 (define_insn "*andc3_v4sf"
898 [(set (match_operand:V4SF 0 "register_operand" "=v")
899 (and:V4SF (not:V4SF (match_operand:V4SF 2 "register_operand" "v"))
900 (match_operand:V4SF 1 "register_operand" "v")))]
903 [(set_attr "type" "vecsimple")])
905 (define_insn "altivec_vpkuhum"
906 [(set (match_operand:V16QI 0 "register_operand" "=v")
907 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
908 (match_operand:V8HI 2 "register_operand" "v")] 93))]
911 [(set_attr "type" "vecperm")])
913 (define_insn "altivec_vpkuwum"
914 [(set (match_operand:V8HI 0 "register_operand" "=v")
915 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
916 (match_operand:V4SI 2 "register_operand" "v")] 94))]
919 [(set_attr "type" "vecperm")])
921 (define_insn "altivec_vpkpx"
922 [(set (match_operand:V8HI 0 "register_operand" "=v")
923 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
924 (match_operand:V4SI 2 "register_operand" "v")] 95))]
927 [(set_attr "type" "vecperm")])
929 (define_insn "altivec_vpkuhss"
930 [(set (match_operand:V16QI 0 "register_operand" "=v")
931 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
932 (match_operand:V8HI 2 "register_operand" "v")] 96))
933 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
936 [(set_attr "type" "vecperm")])
938 (define_insn "altivec_vpkshss"
939 [(set (match_operand:V16QI 0 "register_operand" "=v")
940 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
941 (match_operand:V8HI 2 "register_operand" "v")] 97))
942 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
945 [(set_attr "type" "vecperm")])
947 (define_insn "altivec_vpkuwss"
948 [(set (match_operand:V8HI 0 "register_operand" "=v")
949 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
950 (match_operand:V4SI 2 "register_operand" "v")] 98))
951 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
954 [(set_attr "type" "vecperm")])
956 (define_insn "altivec_vpkswss"
957 [(set (match_operand:V8HI 0 "register_operand" "=v")
958 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
959 (match_operand:V4SI 2 "register_operand" "v")] 99))
960 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
963 [(set_attr "type" "vecperm")])
965 (define_insn "altivec_vpkuhus"
966 [(set (match_operand:V16QI 0 "register_operand" "=v")
967 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
968 (match_operand:V8HI 2 "register_operand" "v")] 100))
969 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
972 [(set_attr "type" "vecperm")])
974 (define_insn "altivec_vpkshus"
975 [(set (match_operand:V16QI 0 "register_operand" "=v")
976 (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
977 (match_operand:V8HI 2 "register_operand" "v")] 101))
978 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
981 [(set_attr "type" "vecperm")])
983 (define_insn "altivec_vpkuwus"
984 [(set (match_operand:V8HI 0 "register_operand" "=v")
985 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
986 (match_operand:V4SI 2 "register_operand" "v")] 102))
987 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
990 [(set_attr "type" "vecperm")])
992 (define_insn "altivec_vpkswus"
993 [(set (match_operand:V8HI 0 "register_operand" "=v")
994 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
995 (match_operand:V4SI 2 "register_operand" "v")] 103))
996 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
999 [(set_attr "type" "vecperm")])
1001 (define_insn "altivec_vrl<VI_char>"
1002 [(set (match_operand:VI 0 "register_operand" "=v")
1003 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
1004 (match_operand:VI 2 "register_operand" "v")] 104))]
1006 "vrl<VI_char> %0,%1,%2"
1007 [(set_attr "type" "vecsimple")])
1009 (define_insn "altivec_vsl<VI_char>"
1010 [(set (match_operand:VI 0 "register_operand" "=v")
1011 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
1012 (match_operand:VI 2 "register_operand" "v")] 107))]
1014 "vsl<VI_char> %0,%1,%2"
1015 [(set_attr "type" "vecsimple")])
1017 (define_insn "altivec_vslw_v4sf"
1018 [(set (match_operand:V4SF 0 "register_operand" "=v")
1019 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")
1020 (match_operand:V4SF 2 "register_operand" "v")] UNSPEC_VSLW))]
1023 [(set_attr "type" "vecsimple")])
1025 (define_insn "altivec_vsl"
1026 [(set (match_operand:V4SI 0 "register_operand" "=v")
1027 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1028 (match_operand:V4SI 2 "register_operand" "v")] 110))]
1031 [(set_attr "type" "vecperm")])
1033 (define_insn "altivec_vslo"
1034 [(set (match_operand:V4SI 0 "register_operand" "=v")
1035 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1036 (match_operand:V4SI 2 "register_operand" "v")] 111))]
1039 [(set_attr "type" "vecperm")])
1041 (define_insn "lshr<mode>3"
1042 [(set (match_operand:VI 0 "register_operand" "=v")
1043 (lshiftrt:VI (match_operand:VI 1 "register_operand" "v")
1044 (match_operand:VI 2 "register_operand" "v") ))]
1046 "vsr<VI_char> %0,%1,%2"
1047 [(set_attr "type" "vecsimple")])
1049 (define_insn "ashr<mode>3"
1050 [(set (match_operand:VI 0 "register_operand" "=v")
1051 (ashiftrt:VI (match_operand:VI 1 "register_operand" "v")
1052 (match_operand:VI 2 "register_operand" "v") ))]
1054 "vsra<VI_char> %0,%1,%2"
1055 [(set_attr "type" "vecsimple")])
1057 (define_insn "altivec_vsr"
1058 [(set (match_operand:V4SI 0 "register_operand" "=v")
1059 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1060 (match_operand:V4SI 2 "register_operand" "v")] 118))]
1063 [(set_attr "type" "vecperm")])
1065 (define_insn "altivec_vsro"
1066 [(set (match_operand:V4SI 0 "register_operand" "=v")
1067 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1068 (match_operand:V4SI 2 "register_operand" "v")] 119))]
1071 [(set_attr "type" "vecperm")])
1073 (define_insn "altivec_vsum4ubs"
1074 [(set (match_operand:V4SI 0 "register_operand" "=v")
1075 (unspec:V4SI [(match_operand:V16QI 1 "register_operand" "v")
1076 (match_operand:V4SI 2 "register_operand" "v")] 131))
1077 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1080 [(set_attr "type" "veccomplex")])
1082 (define_insn "altivec_vsum4s<VI_char>s"
1083 [(set (match_operand:V4SI 0 "register_operand" "=v")
1084 (unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v")
1085 (match_operand:V4SI 2 "register_operand" "v")] 132))
1086 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1088 "vsum4s<VI_char>s %0,%1,%2"
1089 [(set_attr "type" "veccomplex")])
1091 (define_insn "altivec_vsum2sws"
1092 [(set (match_operand:V4SI 0 "register_operand" "=v")
1093 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1094 (match_operand:V4SI 2 "register_operand" "v")] 134))
1095 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1098 [(set_attr "type" "veccomplex")])
1100 (define_insn "altivec_vsumsws"
1101 [(set (match_operand:V4SI 0 "register_operand" "=v")
1102 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1103 (match_operand:V4SI 2 "register_operand" "v")] 135))
1104 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1107 [(set_attr "type" "veccomplex")])
1109 (define_insn "altivec_vspltb"
1110 [(set (match_operand:V16QI 0 "register_operand" "=v")
1111 (vec_duplicate:V16QI
1112 (vec_select:QI (match_operand:V16QI 1 "register_operand" "v")
1114 [(match_operand:QI 2 "immediate_operand" "i")]))))]
1117 [(set_attr "type" "vecperm")])
1119 (define_insn "altivec_vsplth"
1120 [(set (match_operand:V8HI 0 "register_operand" "=v")
1122 (vec_select:HI (match_operand:V8HI 1 "register_operand" "v")
1124 [(match_operand:QI 2 "immediate_operand" "i")]))))]
1127 [(set_attr "type" "vecperm")])
1129 (define_insn "altivec_vspltw"
1130 [(set (match_operand:V4SI 0 "register_operand" "=v")
1132 (vec_select:SI (match_operand:V4SI 1 "register_operand" "v")
1134 [(match_operand:QI 2 "immediate_operand" "i")]))))]
1137 [(set_attr "type" "vecperm")])
1139 (define_insn "altivec_vspltis<VI_char>"
1140 [(set (match_operand:VI 0 "register_operand" "=v")
1142 (match_operand:QI 1 "const_int_operand" "i")))]
1144 "vspltis<VI_char> %0,%1"
1145 [(set_attr "type" "vecperm")])
1147 (define_insn "altivec_vspltisw_v4sf"
1148 [(set (match_operand:V4SF 0 "register_operand" "=v")
1150 (float:SF (match_operand:QI 1 "const_int_operand" "i"))))]
1153 [(set_attr "type" "vecperm")])
1155 (define_insn "ftruncv4sf2"
1156 [(set (match_operand:V4SF 0 "register_operand" "=v")
1157 (fix:V4SF (match_operand:V4SF 1 "register_operand" "v")))]
1160 [(set_attr "type" "vecfloat")])
1162 (define_insn "altivec_vperm_v4sf"
1163 [(set (match_operand:V4SF 0 "register_operand" "=v")
1164 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")
1165 (match_operand:V4SF 2 "register_operand" "v")
1166 (match_operand:V16QI 3 "register_operand" "v")] 145))]
1169 [(set_attr "type" "vecperm")])
1171 (define_insn "altivec_vperm_<mode>"
1172 [(set (match_operand:VI 0 "register_operand" "=v")
1173 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
1174 (match_operand:VI 2 "register_operand" "v")
1175 (match_operand:V16QI 3 "register_operand" "v")] 144))]
1178 [(set_attr "type" "vecperm")])
1180 (define_insn "altivec_vrfip"
1181 [(set (match_operand:V4SF 0 "register_operand" "=v")
1182 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")] 148))]
1185 [(set_attr "type" "vecfloat")])
1187 (define_insn "altivec_vrfin"
1188 [(set (match_operand:V4SF 0 "register_operand" "=v")
1189 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")] 149))]
1192 [(set_attr "type" "vecfloat")])
1194 (define_insn "altivec_vrfim"
1195 [(set (match_operand:V4SF 0 "register_operand" "=v")
1196 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")] 150))]
1199 [(set_attr "type" "vecfloat")])
1201 (define_insn "altivec_vcfux"
1202 [(set (match_operand:V4SF 0 "register_operand" "=v")
1203 (unspec:V4SF [(match_operand:V4SI 1 "register_operand" "v")
1204 (match_operand:QI 2 "immediate_operand" "i")] 151))]
1207 [(set_attr "type" "vecfloat")])
1209 (define_insn "altivec_vcfsx"
1210 [(set (match_operand:V4SF 0 "register_operand" "=v")
1211 (unspec:V4SF [(match_operand:V4SI 1 "register_operand" "v")
1212 (match_operand:QI 2 "immediate_operand" "i")] 152))]
1215 [(set_attr "type" "vecfloat")])
1217 (define_insn "altivec_vctuxs"
1218 [(set (match_operand:V4SI 0 "register_operand" "=v")
1219 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
1220 (match_operand:QI 2 "immediate_operand" "i")] 153))
1221 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1224 [(set_attr "type" "vecfloat")])
1226 (define_insn "altivec_vctsxs"
1227 [(set (match_operand:V4SI 0 "register_operand" "=v")
1228 (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
1229 (match_operand:QI 2 "immediate_operand" "i")] 154))
1230 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
1233 [(set_attr "type" "vecfloat")])
1235 (define_insn "altivec_vlogefp"
1236 [(set (match_operand:V4SF 0 "register_operand" "=v")
1237 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")] 155))]
1240 [(set_attr "type" "vecfloat")])
1242 (define_insn "altivec_vexptefp"
1243 [(set (match_operand:V4SF 0 "register_operand" "=v")
1244 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")] 156))]
1247 [(set_attr "type" "vecfloat")])
1249 (define_insn "altivec_vrsqrtefp"
1250 [(set (match_operand:V4SF 0 "register_operand" "=v")
1251 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")] 157))]
1254 [(set_attr "type" "vecfloat")])
1256 (define_insn "altivec_vrefp"
1257 [(set (match_operand:V4SF 0 "register_operand" "=v")
1258 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")] 158))]
1261 [(set_attr "type" "vecfloat")])
1263 (define_expand "vcondv4si"
1264 [(set (match_operand:V4SI 0 "register_operand" "=v")
1265 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1266 (match_operand:V4SI 2 "register_operand" "v")
1267 (match_operand:V4SI 3 "comparison_operator" "")
1268 (match_operand:V4SI 4 "register_operand" "v")
1269 (match_operand:V4SI 5 "register_operand" "v")
1270 ] UNSPEC_VCOND_V4SI))]
1274 if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
1275 operands[3], operands[4], operands[5]))
1282 (define_expand "vconduv4si"
1283 [(set (match_operand:V4SI 0 "register_operand" "=v")
1284 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1285 (match_operand:V4SI 2 "register_operand" "v")
1286 (match_operand:V4SI 3 "comparison_operator" "")
1287 (match_operand:V4SI 4 "register_operand" "v")
1288 (match_operand:V4SI 5 "register_operand" "v")
1289 ] UNSPEC_VCONDU_V4SI))]
1293 if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
1294 operands[3], operands[4], operands[5]))
1301 (define_expand "vcondv4sf"
1302 [(set (match_operand:V4SF 0 "register_operand" "=v")
1303 (unspec:V4SF [(match_operand:V4SI 1 "register_operand" "v")
1304 (match_operand:V4SF 2 "register_operand" "v")
1305 (match_operand:V4SF 3 "comparison_operator" "")
1306 (match_operand:V4SF 4 "register_operand" "v")
1307 (match_operand:V4SF 5 "register_operand" "v")
1308 ] UNSPEC_VCOND_V4SF))]
1312 if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
1313 operands[3], operands[4], operands[5]))
1320 (define_expand "vcondv8hi"
1321 [(set (match_operand:V4SF 0 "register_operand" "=v")
1322 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
1323 (match_operand:V8HI 2 "register_operand" "v")
1324 (match_operand:V8HI 3 "comparison_operator" "")
1325 (match_operand:V8HI 4 "register_operand" "v")
1326 (match_operand:V8HI 5 "register_operand" "v")
1327 ] UNSPEC_VCOND_V8HI))]
1331 if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
1332 operands[3], operands[4], operands[5]))
1339 (define_expand "vconduv8hi"
1340 [(set (match_operand:V4SF 0 "register_operand" "=v")
1341 (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
1342 (match_operand:V8HI 2 "register_operand" "v")
1343 (match_operand:V8HI 3 "comparison_operator" "")
1344 (match_operand:V8HI 4 "register_operand" "v")
1345 (match_operand:V8HI 5 "register_operand" "v")
1346 ] UNSPEC_VCONDU_V8HI))]
1350 if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
1351 operands[3], operands[4], operands[5]))
1358 (define_expand "vcondv16qi"
1359 [(set (match_operand:V4SF 0 "register_operand" "=v")
1360 (unspec:V16QI [(match_operand:V4SI 1 "register_operand" "v")
1361 (match_operand:V16QI 2 "register_operand" "v")
1362 (match_operand:V16QI 3 "comparison_operator" "")
1363 (match_operand:V16QI 4 "register_operand" "v")
1364 (match_operand:V16QI 5 "register_operand" "v")
1365 ] UNSPEC_VCOND_V16QI))]
1369 if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
1370 operands[3], operands[4], operands[5]))
1377 (define_expand "vconduv16qi"
1378 [(set (match_operand:V4SF 0 "register_operand" "=v")
1379 (unspec:V16QI [(match_operand:V4SI 1 "register_operand" "v")
1380 (match_operand:V16QI 2 "register_operand" "v")
1381 (match_operand:V16QI 3 "comparison_operator" "")
1382 (match_operand:V16QI 4 "register_operand" "v")
1383 (match_operand:V16QI 5 "register_operand" "v")
1384 ] UNSPEC_VCONDU_V16QI))]
1388 if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
1389 operands[3], operands[4], operands[5]))
1397 (define_insn "altivec_vsel_v4si"
1398 [(set (match_operand:V4SI 0 "register_operand" "=v")
1399 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1400 (match_operand:V4SI 2 "register_operand" "v")
1401 (match_operand:V4SI 3 "register_operand" "v")]
1405 [(set_attr "type" "vecperm")])
1407 (define_insn "altivec_vsel_v4sf"
1408 [(set (match_operand:V4SF 0 "register_operand" "=v")
1409 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")
1410 (match_operand:V4SF 2 "register_operand" "v")
1411 (match_operand:V4SI 3 "register_operand" "v")]
1415 [(set_attr "type" "vecperm")])
1417 (define_insn "altivec_vsel_v8hi"
1418 [(set (match_operand:V8HI 0 "register_operand" "=v")
1419 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
1420 (match_operand:V8HI 2 "register_operand" "v")
1421 (match_operand:V8HI 3 "register_operand" "v")]
1425 [(set_attr "type" "vecperm")])
1427 (define_insn "altivec_vsel_v16qi"
1428 [(set (match_operand:V16QI 0 "register_operand" "=v")
1429 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
1430 (match_operand:V16QI 2 "register_operand" "v")
1431 (match_operand:V16QI 3 "register_operand" "v")]
1435 [(set_attr "type" "vecperm")])
1437 (define_insn "altivec_vsldoi_v4si"
1438 [(set (match_operand:V4SI 0 "register_operand" "=v")
1439 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
1440 (match_operand:V4SI 2 "register_operand" "v")
1441 (match_operand:QI 3 "immediate_operand" "i")] 163))]
1443 "vsldoi %0,%1,%2,%3"
1444 [(set_attr "type" "vecperm")])
1446 (define_insn "altivec_vsldoi_v4sf"
1447 [(set (match_operand:V4SF 0 "register_operand" "=v")
1448 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")
1449 (match_operand:V4SF 2 "register_operand" "v")
1450 (match_operand:QI 3 "immediate_operand" "i")] 164))]
1452 "vsldoi %0,%1,%2,%3"
1453 [(set_attr "type" "vecperm")])
1455 (define_insn "altivec_vsldoi_v8hi"
1456 [(set (match_operand:V8HI 0 "register_operand" "=v")
1457 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
1458 (match_operand:V8HI 2 "register_operand" "v")
1459 (match_operand:QI 3 "immediate_operand" "i")] 165))]
1461 "vsldoi %0,%1,%2,%3"
1462 [(set_attr "type" "vecperm")])
1464 (define_insn "altivec_vsldoi_v16qi"
1465 [(set (match_operand:V16QI 0 "register_operand" "=v")
1466 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
1467 (match_operand:V16QI 2 "register_operand" "v")
1468 (match_operand:QI 3 "immediate_operand" "i")] 166))]
1470 "vsldoi %0,%1,%2,%3"
1471 [(set_attr "type" "vecperm")])
1473 (define_insn "altivec_vupkhsb"
1474 [(set (match_operand:V8HI 0 "register_operand" "=v")
1475 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")] 167))]
1478 [(set_attr "type" "vecperm")])
1480 (define_insn "altivec_vupkhpx"
1481 [(set (match_operand:V4SI 0 "register_operand" "=v")
1482 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")] 168))]
1485 [(set_attr "type" "vecperm")])
1487 (define_insn "altivec_vupkhsh"
1488 [(set (match_operand:V4SI 0 "register_operand" "=v")
1489 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")] 169))]
1492 [(set_attr "type" "vecperm")])
1494 (define_insn "altivec_vupklsb"
1495 [(set (match_operand:V8HI 0 "register_operand" "=v")
1496 (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")] 170))]
1499 [(set_attr "type" "vecperm")])
1501 (define_insn "altivec_vupklpx"
1502 [(set (match_operand:V4SI 0 "register_operand" "=v")
1503 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")] 171))]
1506 [(set_attr "type" "vecperm")])
1508 (define_insn "altivec_vupklsh"
1509 [(set (match_operand:V4SI 0 "register_operand" "=v")
1510 (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")] 172))]
1513 [(set_attr "type" "vecperm")])
1515 ;; AltiVec predicates.
1517 (define_expand "cr6_test_for_zero"
1518 [(set (match_operand:SI 0 "register_operand" "=r")
1524 (define_expand "cr6_test_for_zero_reverse"
1525 [(set (match_operand:SI 0 "register_operand" "=r")
1528 (set (match_dup 0) (minus:SI (const_int 1) (match_dup 0)))]
1532 (define_expand "cr6_test_for_lt"
1533 [(set (match_operand:SI 0 "register_operand" "=r")
1539 (define_expand "cr6_test_for_lt_reverse"
1540 [(set (match_operand:SI 0 "register_operand" "=r")
1543 (set (match_dup 0) (minus:SI (const_int 1) (match_dup 0)))]
1547 ;; We can get away with generating the opcode on the fly (%3 below)
1548 ;; because all the predicates have the same scheduling parameters.
1550 (define_insn "altivec_predicate_v4sf"
1552 (unspec:CC [(match_operand:V4SF 1 "register_operand" "v")
1553 (match_operand:V4SF 2 "register_operand" "v")
1554 (match_operand 3 "any_operand" "")] 174))
1555 (clobber (match_scratch:V4SF 0 "=v"))]
1558 [(set_attr "type" "veccmp")])
1560 (define_insn "altivec_predicate_<mode>"
1562 (unspec:CC [(match_operand:VI 1 "register_operand" "v")
1563 (match_operand:VI 2 "register_operand" "v")
1564 (match_operand 3 "any_operand" "")] 173))
1565 (clobber (match_scratch:VI 0 "=v"))]
1568 [(set_attr "type" "veccmp")])
1570 (define_insn "altivec_mtvscr"
1573 [(match_operand:V4SI 0 "register_operand" "v")] 186))]
1576 [(set_attr "type" "vecsimple")])
1578 (define_insn "altivec_mfvscr"
1579 [(set (match_operand:V8HI 0 "register_operand" "=v")
1580 (unspec_volatile:V8HI [(reg:SI 110)] 187))]
1583 [(set_attr "type" "vecsimple")])
1585 (define_insn "altivec_dssall"
1586 [(unspec_volatile [(const_int 0)] 188)]
1589 [(set_attr "type" "vecsimple")])
1591 (define_insn "altivec_dss"
1592 [(unspec_volatile [(match_operand:QI 0 "immediate_operand" "i")] 189)]
1595 [(set_attr "type" "vecsimple")])
1597 (define_insn "altivec_dst"
1598 [(unspec [(match_operand 0 "register_operand" "b")
1599 (match_operand:SI 1 "register_operand" "r")
1600 (match_operand:QI 2 "immediate_operand" "i")] 190)]
1601 "TARGET_ALTIVEC && GET_MODE (operands[0]) == Pmode"
1603 [(set_attr "type" "vecsimple")])
1605 (define_insn "altivec_dstt"
1606 [(unspec [(match_operand 0 "register_operand" "b")
1607 (match_operand:SI 1 "register_operand" "r")
1608 (match_operand:QI 2 "immediate_operand" "i")] 191)]
1609 "TARGET_ALTIVEC && GET_MODE (operands[0]) == Pmode"
1611 [(set_attr "type" "vecsimple")])
1613 (define_insn "altivec_dstst"
1614 [(unspec [(match_operand 0 "register_operand" "b")
1615 (match_operand:SI 1 "register_operand" "r")
1616 (match_operand:QI 2 "immediate_operand" "i")] 192)]
1617 "TARGET_ALTIVEC && GET_MODE (operands[0]) == Pmode"
1619 [(set_attr "type" "vecsimple")])
1621 (define_insn "altivec_dststt"
1622 [(unspec [(match_operand 0 "register_operand" "b")
1623 (match_operand:SI 1 "register_operand" "r")
1624 (match_operand:QI 2 "immediate_operand" "i")] 193)]
1625 "TARGET_ALTIVEC && GET_MODE (operands[0]) == Pmode"
1627 [(set_attr "type" "vecsimple")])
1629 (define_insn "altivec_lvsl"
1630 [(set (match_operand:V16QI 0 "register_operand" "=v")
1631 (unspec:V16QI [(match_operand 1 "memory_operand" "m")] 194))]
1634 [(set_attr "type" "vecload")])
1636 (define_insn "altivec_lvsr"
1637 [(set (match_operand:V16QI 0 "register_operand" "=v")
1638 (unspec:V16QI [(match_operand 1 "memory_operand" "m")] 195))]
1641 [(set_attr "type" "vecload")])
1643 (define_expand "build_vector_mask_for_load"
1644 [(set (match_operand:V16QI 0 "register_operand" "=v")
1645 (unspec:V16QI [(match_operand 1 "memory_operand" "m")] 195))]
1652 gcc_assert (GET_CODE (operands[1]) == MEM);
1654 addr = XEXP (operands[1], 0);
1655 temp = gen_reg_rtx (GET_MODE (addr));
1656 emit_insn (gen_rtx_SET (VOIDmode, temp,
1657 gen_rtx_NEG (GET_MODE (addr), addr)));
1658 emit_insn (gen_altivec_lvsr (operands[0],
1659 gen_rtx_MEM (GET_MODE (operands[1]), temp)));
1663 ;; Parallel some of the LVE* and STV*'s with unspecs because some have
1664 ;; identical rtl but different instructions-- and gcc gets confused.
1666 (define_insn "altivec_lve<VI_char>x"
1668 [(set (match_operand:VI 0 "register_operand" "=v")
1669 (match_operand:VI 1 "memory_operand" "m"))
1670 (unspec [(const_int 0)] 196)])]
1672 "lve<VI_char>x %0,%y1"
1673 [(set_attr "type" "vecload")])
1675 (define_insn "altivec_lvxl"
1677 [(set (match_operand:V4SI 0 "register_operand" "=v")
1678 (match_operand:V4SI 1 "memory_operand" "m"))
1679 (unspec [(const_int 0)] UNSPEC_SET_VSCR)])]
1682 [(set_attr "type" "vecload")])
1684 (define_insn "altivec_lvx"
1685 [(set (match_operand:V4SI 0 "register_operand" "=v")
1686 (match_operand:V4SI 1 "memory_operand" "m"))]
1689 [(set_attr "type" "vecload")])
1691 (define_insn "altivec_stvx"
1693 [(set (match_operand:V4SI 0 "memory_operand" "=m")
1694 (match_operand:V4SI 1 "register_operand" "v"))
1695 (unspec [(const_int 0)] 201)])]
1698 [(set_attr "type" "vecstore")])
1700 (define_insn "altivec_stvxl"
1702 [(set (match_operand:V4SI 0 "memory_operand" "=m")
1703 (match_operand:V4SI 1 "register_operand" "v"))
1704 (unspec [(const_int 0)] 202)])]
1707 [(set_attr "type" "vecstore")])
1709 (define_insn "altivec_stve<VI_char>x"
1711 [(set (match_operand:VI 0 "memory_operand" "=m")
1712 (match_operand:VI 1 "register_operand" "v"))
1713 (unspec [(const_int 0)] 203)])]
1715 "stve<VI_char>x %1,%y0"
1716 [(set_attr "type" "vecstore")])
1719 ;; vspltis? SCRATCH0,0
1720 ;; vsubu?m SCRATCH2,SCRATCH1,%1
1721 ;; vmaxs? %0,%1,SCRATCH2"
1722 (define_expand "abs<mode>2"
1723 [(set (match_dup 2) (vec_duplicate:VI (const_int 0)))
1725 (minus:VI (match_dup 2)
1726 (match_operand:VI 1 "register_operand" "v")))
1727 (set (match_operand:VI 0 "register_operand" "=v")
1728 (smax:VI (match_dup 1) (match_dup 3)))]
1731 operands[2] = gen_reg_rtx (GET_MODE (operands[0]));
1732 operands[3] = gen_reg_rtx (GET_MODE (operands[0]));
1736 ;; vspltisw SCRATCH1,-1
1737 ;; vslw SCRATCH2,SCRATCH1,SCRATCH1
1738 ;; vandc %0,%1,SCRATCH2
1739 (define_expand "absv4sf2"
1741 (vec_duplicate:V4SF (float:SF (const_int -1))))
1743 (unspec:V4SF [(match_dup 2) (match_dup 2)] UNSPEC_VSLW))
1744 (set (match_operand:V4SF 0 "register_operand" "=v")
1745 (and:V4SF (not:V4SF (match_dup 3))
1746 (match_operand:V4SF 1 "register_operand" "v")))]
1749 operands[2] = gen_reg_rtx (V4SFmode);
1750 operands[3] = gen_reg_rtx (V4SFmode);
1754 ;; vspltis? SCRATCH0,0
1755 ;; vsubs?s SCRATCH2,SCRATCH1,%1
1756 ;; vmaxs? %0,%1,SCRATCH2"
1757 (define_expand "altivec_abss_<mode>"
1758 [(set (match_dup 2) (vec_duplicate:VI (const_int 0)))
1759 (parallel [(set (match_dup 3)
1760 (unspec:VI [(match_dup 2)
1761 (match_operand:VI 1 "register_operand" "v")]
1763 (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))])
1764 (set (match_operand:VI 0 "register_operand" "=v")
1765 (smax:VI (match_dup 1) (match_dup 3)))]
1768 operands[2] = gen_reg_rtx (GET_MODE (operands[0]));
1769 operands[3] = gen_reg_rtx (GET_MODE (operands[0]));
1772 (define_insn "vec_realign_load_v4sf"
1773 [(set (match_operand:V4SF 0 "register_operand" "=v")
1774 (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")
1775 (match_operand:V4SF 2 "register_operand" "v")
1776 (match_operand:V16QI 3 "register_operand" "v")] 216))]
1779 [(set_attr "type" "vecperm")])
1781 (define_insn "vec_realign_load_<mode>"
1782 [(set (match_operand:VI 0 "register_operand" "=v")
1783 (unspec:VI [(match_operand:VI 1 "register_operand" "v")
1784 (match_operand:VI 2 "register_operand" "v")
1785 (match_operand:V16QI 3 "register_operand" "v")] 215))]
1788 [(set_attr "type" "vecperm")])