1 
2 /* { dg-do compile } */
3 /* { dg-require-effective-target powerpc_altivec_ok } */
4 /* { dg-options "-maltivec -mno-vsx -mno-power8-vector -O0" } */
5 
6 #include <altivec.h>
7 
8 /* Test Altivec built-ins added for version 1.1 of ELFv2 ABI.  */
9 
10 vector signed int vsia, vsib;
11 vector signed short vssa, vssb, vssc;
12 vector unsigned short vusa, vusb, vusc;
13 
foo(vector signed int * vsir,vector signed short * vssr,vector unsigned short * vusr)14 void foo (vector signed int *vsir,
15 	  vector signed short *vssr,
16 	  vector unsigned short *vusr)
17 {
18   *vsir++ = vec_addc (vsia, vsib);
19   *vssr++ = vec_madd (vssa, vssb, vssc);
20   *vssr++ = vec_madd (vssa, vusb, vusc);
21   *vssr++ = vec_madd (vusa, vssb, vssc);
22   *vusr++ = vec_madd (vusa, vusb, vusc);
23 
24   *vssr++ = vec_madds (vssa, vssb, vssc);
25 }
26 
27 /* { dg-final { scan-assembler-times "vaddcuw" 1 } } */
28 /* { dg-final { scan-assembler-times "vmladduhm" 4 } } */
29 /* { dg-final { scan-assembler-times "vmhaddshs" 1 } } */
30