c++: normalizing ttp constraints [PR115656]
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / builtins-3-p8.c
blobf641d306ec389fdfc789b378a30610f264b4e78d
1 /* { dg-do compile } */
2 /* { dg-options "-maltivec -mdejagnu-cpu=power8 -mvsx" } */
3 /* { dg-require-effective-target powerpc_vsx } */
5 #include <altivec.h>
7 vector bool long long
8 test_eq_long_long (vector bool long long x, vector bool long long y)
10 return vec_cmpeq (x, y);
13 vector unsigned char
14 test_vsi_packs_vusi_vusi (vector unsigned short x,
15 vector unsigned short y)
17 return vec_packs (x, y);
20 vector signed char
21 test_vsi_packs_vssi_vssi (vector signed short x,
22 vector signed short y)
24 return vec_packs (x, y);
27 vector signed short int
28 test_vsi_packs_vsi_vsi (vector signed int x,
29 vector signed int y)
31 return vec_packs (x, y);
34 vector unsigned short int
35 test_vsi_packs_vui_vui (vector unsigned int x,
36 vector unsigned int y)
38 return vec_packs (x, y);
41 vector signed int
42 test_vsi_packs_vsll_vsll (vector signed long long x,
43 vector signed long long y)
45 return vec_packs (x, y);
48 vector unsigned int
49 test_vui_packs_vull_vull (vector unsigned long long x,
50 vector unsigned long long y)
52 return vec_packs (x, y);
55 vector unsigned char
56 test_vsi_packsu_vssi_vssi (vector signed short x,
57 vector signed short y)
59 return vec_packsu (x, y);
62 vector unsigned char
63 test_vsi_packsu_vusi_vusi (vector unsigned short x,
64 vector unsigned short y)
66 return vec_packsu (x, y);
69 vector unsigned int
70 test_vsi_packsu_vsll_vsll (vector signed long long x,
71 vector signed long long y)
73 return vec_packsu (x, y);
76 vector unsigned int
77 test_vsi_packsu_vull_vull (vector unsigned long long x,
78 vector unsigned long long y)
80 return vec_packsu (x, y);
83 vector unsigned short int
84 test_vsi_packsu_vsi_vsi (vector signed int x,
85 vector signed int y)
87 return vec_packsu (x, y);
90 vector unsigned short int
91 test_vsi_packsu_vui_vui (vector unsigned int x,
92 vector unsigned int y)
94 return vec_packsu (x, y);
97 vector unsigned char
98 test_unsigned_char_popcnt_signed_char (vector signed char x)
100 return vec_popcnt (x);
103 vector unsigned char
104 test_unsigned_char_popcnt_unsigned_char (vector unsigned char x)
106 return vec_popcnt (x);
109 vector unsigned short
110 test_unsigned_short_popcnt_signed_short (vector short x)
112 return vec_popcnt (x);
115 vector unsigned short
116 test_unsigned_short_popcnt_unsigned_short (vector unsigned short x)
118 return vec_popcnt (x);
121 vector unsigned int
122 test_unsigned_int_popcnt_signed_int (vector int x)
124 return vec_popcnt (x);
127 vector unsigned int
128 test_unsigned_int_popcnt_unsigned_int (vector unsigned x)
130 return vec_popcnt (x);
133 vector unsigned long long
134 test_unsigned_long_lont_popcnt_signed_long (vector long long x)
136 return vec_popcnt (x);
139 vector unsigned long long
140 test_unsigned_long_long_popcnt_unsigned_long (vector unsigned long long x)
142 return vec_popcnt (x);
145 vector signed short
146 test_vss_mradds_vss_vss (vector signed short x, vector signed short y,
147 vector signed short z)
149 return vec_mradds (x, y, z);
152 vector signed long long
153 test_vsll_mule_vsi_vsi (vector signed int x, vector signed int y)
155 return vec_mule (x, y);
158 vector unsigned long long
159 test_vull_mule_vui_vui (vector unsigned int x, vector unsigned int y)
161 return vec_mule (x, y);
164 vector signed long long
165 test_vsll_mulo_vsi_vsi (vector signed int x, vector signed int y)
167 return vec_mulo (x, y);
170 vector unsigned long long
171 test_vull_mulo_vui_vui (vector unsigned int x, vector unsigned int y)
173 return vec_mulo (x, y);
176 vector signed char
177 test_neg_char (vector signed char x)
179 return vec_neg (x);
182 vector short
183 test_neg_short (vector short x)
185 return vec_neg (x);
188 vector int
189 test_neg_int (vector int x)
191 return vec_neg (x);
194 vector float
195 test_neg_float (vector float x)
197 return vec_neg (x);
200 vector double
201 test_neg_double (vector double x)
203 return vec_neg (x);
207 /* Expected test results:
209 test_eq_long_long 1 vcmpequd inst
210 test_vsi_packs_vsll_vsll 1 vpksdss
211 test_vui_packs_vull_vull 1 vpkudus
212 test_vui_packs_vssi_vssi 1 vpkshss
213 test_vsi_packsu_vssi_vssi 1 vpkshus
214 test_vsi_packsu_vsll_vsll 1 vpksdus
215 test_vsi_packsu_vull_vull 1 vpkudus
216 test_unsigned_char_popcnt_signed_char 1 vpopcntb
217 test_unsigned_char_popcnt_unsigned_char 1 vpopcntb
218 test_unsigned_short_popcnt_signed_short 1 vpopcnth
219 test_unsigned_short_popcnt_unsigned_short 1 vpopcnth
220 test_unsigned_int_popcnt_signed_int 2 vpopcntw
221 test_unsigned_int_popcnt_unsigned_int 1 vpopcntd
222 test_unsigned_long_long_popcnt_unsigned_long 1 vpopcntd
223 test_vss_mradds_vss_vsss 1 vmhraddshs
224 test_vsll_mulo_vsi_vsi 1 vmulosw
225 test_vull_mulo_vui_vui 1 vmulouw
226 test_vsll_mule_vsi_vsi 1 vmulesw
227 test_vull_mule_vui_vui 1 vmuleuw
228 test_neg_char 1 vspltisw, 1 vsububm
229 test_neg_short 1 vspltisw, 1 vsubuhm
230 test_neg_int 1 vspltisw, 1 vsubuwm
231 test_neg_float 1 xvnegsp
232 test_neg_float 1 xvnegdp
235 /* { dg-final { scan-assembler-times "vcmpequd" 1 } } */
236 /* { dg-final { scan-assembler-times "vpksdss" 1 } } */
237 /* { dg-final { scan-assembler-times "vpkudus" 2 } } */
238 /* { dg-final { scan-assembler-times "vpkuhus" 2 } } */
239 /* { dg-final { scan-assembler-times "vpkshss" 1 } } */
240 /* { dg-final { scan-assembler-times "vpkshus" 1 } } */
241 /* { dg-final { scan-assembler-times "vpksdus" 1 } } */
242 /* { dg-final { scan-assembler-times "vpkuwus" 2 } } */
243 /* { dg-final { scan-assembler-times "vpopcntb" 2 } } */
244 /* { dg-final { scan-assembler-times "vpopcnth" 2 } } */
245 /* { dg-final { scan-assembler-times "vpopcntw" 2 } } */
246 /* { dg-final { scan-assembler-times "vpopcntd" 2 } } */
247 /* { dg-final { scan-assembler-times "vmhraddshs" 1 } } */
248 /* { dg-final { scan-assembler-times "vmulosw" 1 } } */
249 /* { dg-final { scan-assembler-times "vmulouw" 1 } } */
250 /* { dg-final { scan-assembler-times "vmulesw" 1 } } */
251 /* { dg-final { scan-assembler-times "vmuleuw" 1 } } */
252 /* { dg-final { scan-assembler-times "vspltisw" 3 } } */
253 /* { dg-final { scan-assembler-times "vsububm" 1 } } */
254 /* { dg-final { scan-assembler-times "vsubuhm" 1 } } */
255 /* { dg-final { scan-assembler-times "vsubuwm" 1 } } */
256 /* { dg-final { scan-assembler-times "xvnegsp" 1 } } */
257 /* { dg-final { scan-assembler-times "xvnegdp" 1 } } */