Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / p8vector-builtin-4.c
blob4322c38277b547137999197e7015335ed333a8c9
1 /* { dg-do compile { target { powerpc*-*-* } } } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-require-effective-target powerpc_p8vector_ok } */
4 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
5 /* { dg-options "-mcpu=power8 -O3 -ftree-vectorize -fvect-cost-model=dynamic" } */
7 #include <altivec.h>
9 typedef vector long long vll_sign;
10 typedef vector unsigned long long vll_uns;
11 typedef vector bool long long vll_bool;
13 typedef vector int vi_sign;
14 typedef vector unsigned int vi_uns;
15 typedef vector bool int vi_bool;
17 typedef vector short vs_sign;
18 typedef vector unsigned short vs_uns;
19 typedef vector bool short vs_bool;
21 typedef vector signed char vc_sign;
22 typedef vector unsigned char vc_uns;
23 typedef vector bool char vc_bool;
25 vll_sign vll_clz_1 (vll_sign a)
27 return __builtin_altivec_vclzd (a);
30 vll_sign vll_clz_2 (vll_sign a)
32 return vec_vclz (a);
35 vll_sign vll_clz_3 (vll_sign a)
37 return vec_vclzd (a);
40 vll_uns vll_clz_4 (vll_uns a)
42 return vec_vclz (a);
45 vll_uns vll_clz_5 (vll_uns a)
47 return vec_vclzd (a);
50 vi_sign vi_clz_1 (vi_sign a)
52 return __builtin_altivec_vclzw (a);
55 vi_sign vi_clz_2 (vi_sign a)
57 return vec_vclz (a);
60 vi_sign vi_clz_3 (vi_sign a)
62 return vec_vclzw (a);
65 vi_uns vi_clz_4 (vi_uns a)
67 return vec_vclz (a);
70 vi_uns vi_clz_5 (vi_uns a)
72 return vec_vclzw (a);
75 vs_sign vs_clz_1 (vs_sign a)
77 return __builtin_altivec_vclzh (a);
80 vs_sign vs_clz_2 (vs_sign a)
82 return vec_vclz (a);
85 vs_sign vs_clz_3 (vs_sign a)
87 return vec_vclzh (a);
90 vs_uns vs_clz_4 (vs_uns a)
92 return vec_vclz (a);
95 vs_uns vs_clz_5 (vs_uns a)
97 return vec_vclzh (a);
100 vc_sign vc_clz_1 (vc_sign a)
102 return __builtin_altivec_vclzb (a);
105 vc_sign vc_clz_2 (vc_sign a)
107 return vec_vclz (a);
110 vc_sign vc_clz_3 (vc_sign a)
112 return vec_vclzb (a);
115 vc_uns vc_clz_4 (vc_uns a)
117 return vec_vclz (a);
120 vc_uns vc_clz_5 (vc_uns a)
122 return vec_vclzb (a);
125 vll_sign vll_popcnt_1 (vll_sign a)
127 return __builtin_altivec_vpopcntd (a);
130 vll_sign vll_popcnt_2 (vll_sign a)
132 return vec_vpopcnt (a);
135 vll_sign vll_popcnt_3 (vll_sign a)
137 return vec_vpopcntd (a);
140 vll_uns vll_popcnt_4 (vll_uns a)
142 return vec_vpopcnt (a);
145 vll_uns vll_popcnt_5 (vll_uns a)
147 return vec_vpopcntd (a);
150 vi_sign vi_popcnt_1 (vi_sign a)
152 return __builtin_altivec_vpopcntw (a);
155 vi_sign vi_popcnt_2 (vi_sign a)
157 return vec_vpopcnt (a);
160 vi_sign vi_popcnt_3 (vi_sign a)
162 return vec_vpopcntw (a);
165 vi_uns vi_popcnt_4 (vi_uns a)
167 return vec_vpopcnt (a);
170 vi_uns vi_popcnt_5 (vi_uns a)
172 return vec_vpopcntw (a);
175 vs_sign vs_popcnt_1 (vs_sign a)
177 return __builtin_altivec_vpopcnth (a);
180 vs_sign vs_popcnt_2 (vs_sign a)
182 return vec_vpopcnt (a);
185 vs_sign vs_popcnt_3 (vs_sign a)
187 return vec_vpopcnth (a);
190 vs_uns vs_popcnt_4 (vs_uns a)
192 return vec_vpopcnt (a);
195 vs_uns vs_popcnt_5 (vs_uns a)
197 return vec_vpopcnth (a);
200 vc_sign vc_popcnt_1 (vc_sign a)
202 return __builtin_altivec_vpopcntb (a);
205 vc_sign vc_popcnt_2 (vc_sign a)
207 return vec_vpopcnt (a);
210 vc_sign vc_popcnt_3 (vc_sign a)
212 return vec_vpopcntb (a);
215 vc_uns vc_popcnt_4 (vc_uns a)
217 return vec_vpopcnt (a);
220 vc_uns vc_popcnt_5 (vc_uns a)
222 return vec_vpopcntb (a);
225 vc_uns vc_gbb_1 (vc_uns a)
227 return __builtin_altivec_vgbbd (a);
230 vc_sign vc_gbb_2 (vc_sign a)
232 return vec_vgbbd (a);
235 vc_uns vc_gbb_3 (vc_uns a)
237 return vec_vgbbd (a);
240 /* { dg-final { scan-assembler-times "vclzd" 5 } } */
241 /* { dg-final { scan-assembler-times "vclzw" 5 } } */
242 /* { dg-final { scan-assembler-times "vclzh" 5 } } */
243 /* { dg-final { scan-assembler-times "vclzb" 5 } } */
245 /* { dg-final { scan-assembler-times "vpopcntd" 5 } } */
246 /* { dg-final { scan-assembler-times "vpopcntw" 5 } } */
247 /* { dg-final { scan-assembler-times "vpopcnth" 5 } } */
248 /* { dg-final { scan-assembler-times "vpopcntb" 5 } } */
250 /* { dg-final { scan-assembler-times "vgbbd" 3 } } */