Use conditional internal functions in if-conversion
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / altivec-7.c
blobebc4a85ed8bb102536f179d56963453d6a8dd126
1 /* { dg-do compile { target powerpc*-*-* } } */
2 /* { dg-require-effective-target powerpc_altivec_ok } */
3 /* { dg-options "-maltivec" } */
5 /* Origin: Aldy Hernandez <aldyh@redhat.com> */
7 #include <altivec.h>
9 int **intp;
10 int *var_int;
11 unsigned int **uintp;
12 vector pixel *varpixel;
13 vector signed char *vecchar;
14 vector signed int *vecint;
15 vector signed short *vecshort;
16 vector unsigned char *vecuchar;
17 vector unsigned int *vecuint;
18 vector bool int *vecubi;
19 vector bool char *vecubci;
20 vector bool short int *vecubsi;
21 vector unsigned short *vecushort;
22 vector bool int *vecbint;
23 vector float *vecfloat;
25 int main ()
27 *vecfloat++ = vec_andc((vector bool int)vecint[0], vecfloat[1]);
28 *vecfloat++ = vec_andc(vecfloat[0], (vector bool int)vecint[1]);
29 *vecfloat++ = vec_vxor((vector bool int)vecint[0], vecfloat[1]);
30 *vecfloat++ = vec_vxor(vecfloat[0], (vector bool int)vecint[1]);
31 *varpixel++ = vec_packpx(vecuint[0], vecuint[1]);
32 *varpixel++ = vec_vpkpx(vecuint[0], vecuint[1]);
33 *vecshort++ = vec_vmulesb(vecchar[0], vecchar[1]);
34 *vecshort++ = vec_vmulosb(vecchar[0], vecchar[1]);
35 *vecint++ = vec_ld(var_int[0], intp[1]);
36 *vecint++ = vec_lde(var_int[0], intp[1]);
37 *vecint++ = vec_ldl(var_int[0], intp[1]);
38 *vecint++ = vec_lvewx(var_int[0], intp[1]);
39 *vecint++ = vec_unpackh(vecshort[0]);
40 *vecint++ = vec_unpackl(vecshort[0]);
41 *vecushort++ = vec_andc((vector bool short)vecshort[0], vecushort[1]);
42 *vecushort++ = vec_andc(vecushort[0], (vector bool short)vecshort[1]);
43 *vecushort++ = vec_vxor((vector bool short)vecshort[0], vecushort[1]);
44 *vecushort++ = vec_vxor(vecushort[0], (vector bool short)vecshort[1]);
45 *vecuint++ = vec_ld(var_int[0], uintp[1]);
46 *vecuint++ = vec_lvx(var_int[0], uintp[1]);
47 *vecuint++ = vec_vmsumubm(vecuchar[0], vecuchar[1], vecuint[2]);
48 *vecuchar++ = vec_xor(vecuchar[0], (vector unsigned char)vecchar[1]);
50 *vecubi++ = vec_unpackh(vecubsi[0]);
51 *vecuint++ = vec_unpackh(varpixel[0]);
52 *vecubsi++ = vec_unpackh(vecubci[0]);
53 *vecshort++ = vec_unpackh(vecchar[0]);
55 *vecubi++ = vec_unpackl(vecubsi[0]);
56 *vecuint++ = vec_unpackl(varpixel[0]);
57 *vecubsi++ = vec_unpackl(vecubci[0]);
58 *vecshort++ = vec_unpackl(vecchar[0]);
60 return 0;
63 /* Expected results:
64 vec_packpx vpkpx
65 vec_vmulosb vmulesb
66 vec_ld lxv2x
67 vec_lde lvewx
68 vec_ldl lxvl
69 vec_lvewx lvewx
70 vec_unpackh vupklsh
71 vec_unpackh vupklpx
72 vec_unpackh vupklsb
73 vec_unpackl vupkhsh
74 vec_unpackl vupkhpx
75 vec_unpackl vupkhsb
76 vec_andc xxlnor (vnor AIX)
77 xxland (vand AIX)
78 vec_vxor xxlxor
79 vec_vmsumubm vmsumubm
80 vec_vmulesb vmulosb
81 vec_vmulosb vmulesb
82 vec_ld lvx
85 /* { dg-final { scan-assembler-times "vpkpx" 2 } } */
86 /* { dg-final { scan-assembler-times "vmulesb" 1 } } */
87 /* { dg-final { scan-assembler-times "vmulosb" 1 } } */
88 /* { dg-final { scan-assembler-times {\mlvx\M} 0 { target { powerpc*-*-linux* } } } } */
89 /* { dg-final { scan-assembler-times {\mlvx\M} 42 { target { powerpc*-*-aix* } } } } */
90 /* { dg-final { scan-assembler-times "lvewx" 2 } } */
91 /* { dg-final { scan-assembler-times "lvxl" 1 } } */
92 /* { dg-final { scan-assembler-times "vupklsh" 2 } } */
93 /* { dg-final { scan-assembler-times "vupkhsh" 2 } } */
94 /* { dg-final { scan-assembler-times {\mxxlnor\M|\mvnor\M} 4 } } */
95 /* { dg-final { scan-assembler-times {\mxxland\M|\mvand\M} 4 } } */
96 /* { dg-final { scan-assembler-times {\mxxlxor\M|\mvxor\M} 5 } } */
97 /* { dg-final { scan-assembler-times "xxlandc" 0 } } */
98 /* { dg-final { scan-assembler-times "vmsumubm" 1 } } */
99 /* { dg-final { scan-assembler-times "vupklpx" 1 } } */
100 /* { dg-final { scan-assembler-times "vupklsx" 0 } } */
101 /* { dg-final { scan-assembler-times "vupklsb" 2 } } */
102 /* { dg-final { scan-assembler-times "vupkhpx" 1 } } */
103 /* { dg-final { scan-assembler-times "vupkhsb" 2 } } */