[committed] ft32 doesn't support trampolines.
[official-gcc.git] / gcc / testsuite / gcc.target / mips / mips-3d-5.c
blob86523d27377b7adead619b8a35ec4e7ec82e570d
1 /* { dg-do run } */
2 /* { dg-options "-mips3d forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
4 /* Test MIPS-3D absolute-compare & branch-if-any-four builtin functions */
5 #include <stdlib.h>
6 #include <stdio.h>
8 typedef float v2sf __attribute__ ((vector_size(8)));
10 NOMIPS16 int test0 (v2sf a, v2sf b, v2sf c, v2sf d);
11 NOMIPS16 int test1 (v2sf a, v2sf b, v2sf c, v2sf d);
12 NOMIPS16 int test2 (v2sf a, v2sf b, v2sf c, v2sf d);
13 NOMIPS16 int test3 (v2sf a, v2sf b, v2sf c, v2sf d);
14 NOMIPS16 int test4 (v2sf a, v2sf b, v2sf c, v2sf d);
15 NOMIPS16 int test5 (v2sf a, v2sf b, v2sf c, v2sf d);
16 NOMIPS16 int test6 (v2sf a, v2sf b, v2sf c, v2sf d);
17 NOMIPS16 int test7 (v2sf a, v2sf b, v2sf c, v2sf d);
18 NOMIPS16 int test8 (v2sf a, v2sf b, v2sf c, v2sf d);
19 NOMIPS16 int test9 (v2sf a, v2sf b, v2sf c, v2sf d);
20 NOMIPS16 int test10 (v2sf a, v2sf b, v2sf c, v2sf d);
21 NOMIPS16 int test11 (v2sf a, v2sf b, v2sf c, v2sf d);
22 NOMIPS16 int test12 (v2sf a, v2sf b, v2sf c, v2sf d);
23 NOMIPS16 int test13 (v2sf a, v2sf b, v2sf c, v2sf d);
24 NOMIPS16 int test14 (v2sf a, v2sf b, v2sf c, v2sf d);
25 NOMIPS16 int test15 (v2sf a, v2sf b, v2sf c, v2sf d);
26 NOMIPS16 int test16 (v2sf a, v2sf b, v2sf c, v2sf d);
27 NOMIPS16 int test17 (v2sf a, v2sf b, v2sf c, v2sf d);
28 NOMIPS16 int test18 (v2sf a, v2sf b, v2sf c, v2sf d);
29 NOMIPS16 int test19 (v2sf a, v2sf b, v2sf c, v2sf d);
30 NOMIPS16 int test20 (v2sf a, v2sf b, v2sf c, v2sf d);
31 NOMIPS16 int test21 (v2sf a, v2sf b, v2sf c, v2sf d);
32 NOMIPS16 int test22 (v2sf a, v2sf b, v2sf c, v2sf d);
33 NOMIPS16 int test23 (v2sf a, v2sf b, v2sf c, v2sf d);
34 NOMIPS16 int test24 (v2sf a, v2sf b, v2sf c, v2sf d);
35 NOMIPS16 int test25 (v2sf a, v2sf b, v2sf c, v2sf d);
36 NOMIPS16 int test26 (v2sf a, v2sf b, v2sf c, v2sf d);
37 NOMIPS16 int test27 (v2sf a, v2sf b, v2sf c, v2sf d);
38 NOMIPS16 int test28 (v2sf a, v2sf b, v2sf c, v2sf d);
39 NOMIPS16 int test29 (v2sf a, v2sf b, v2sf c, v2sf d);
40 NOMIPS16 int test30 (v2sf a, v2sf b, v2sf c, v2sf d);
41 NOMIPS16 int test31 (v2sf a, v2sf b, v2sf c, v2sf d);
43 float qnan = 1.0f/0.0f - 1.0f/0.0f;
45 NOMIPS16 int main ()
47 v2sf a, b, c, d;
48 int i, j;
50 /* cabs.eq.ps */
51 a = (v2sf) {11, 22};
52 b = (v2sf) {-33, -44};
53 c = (v2sf) {55, 66};
54 d = (v2sf) {-77, -88};
55 i = 0;
56 j = 0;
57 if (__builtin_mips_any_cabs_eq_4s(a, b, c, d) != i)
58 abort ();
59 if (__builtin_mips_all_cabs_eq_4s(a, b, c, d) != j)
60 abort ();
62 /* cabs.eq.ps */
63 a = (v2sf) {11, 22};
64 b = (v2sf) {-11, -44};
65 c = (v2sf) {55, 66};
66 d = (v2sf) {-77, -88};
67 i = 1;
68 j = 0;
69 if (__builtin_mips_any_cabs_eq_4s(a, b, c, d) != i)
70 abort ();
71 if (__builtin_mips_all_cabs_eq_4s(a, b, c, d) != j)
72 abort ();
74 /* cabs.eq.ps */
75 a = (v2sf) {11, 22};
76 b = (v2sf) {-33, -22};
77 c = (v2sf) {55, 66};
78 d = (v2sf) {-77, -88};
79 i = 1;
80 j = 0;
81 if (__builtin_mips_any_cabs_eq_4s(a, b, c, d) != i)
82 abort ();
83 if (__builtin_mips_all_cabs_eq_4s(a, b, c, d) != j)
84 abort ();
86 /* cabs.eq.ps */
87 a = (v2sf) {11, 22};
88 b = (v2sf) {-33, -44};
89 c = (v2sf) {55, 66};
90 d = (v2sf) {-55, -88};
91 i = 1;
92 j = 0;
93 if (__builtin_mips_any_cabs_eq_4s(a, b, c, d) != i)
94 abort ();
95 if (__builtin_mips_all_cabs_eq_4s(a, b, c, d) != j)
96 abort ();
98 /* cabs.eq.ps */
99 a = (v2sf) {11, 22};
100 b = (v2sf) {-33, -44};
101 c = (v2sf) {55, 66};
102 d = (v2sf) {-77, -66};
103 i = 1;
104 j = 0;
105 if (__builtin_mips_any_cabs_eq_4s(a, b, c, d) != i)
106 abort ();
107 if (__builtin_mips_all_cabs_eq_4s(a, b, c, d) != j)
108 abort ();
110 /* cabs.eq.ps */
111 a = (v2sf) {11, 22};
112 b = (v2sf) {-11, -22};
113 c = (v2sf) {55, 66};
114 d = (v2sf) {-55, -66};
115 i = 1;
116 j = 1;
117 if (__builtin_mips_any_cabs_eq_4s(a, b, c, d) != i)
118 abort ();
119 if (__builtin_mips_all_cabs_eq_4s(a, b, c, d) != j)
120 abort ();
122 /* Test all comparisons */
123 a = (v2sf) {11, 33};
124 b = (v2sf) {-33, -11};
125 c = (v2sf) {55, 66};
126 d = (v2sf) {-55, -88};
128 i = test0 (a, b, c, d);
129 if (i != 0)
130 abort ();
131 i = test1 (a, b, c, d);
132 if (i != 0)
133 abort ();
134 i = test2 (a, b, c, d);
135 if (i != 0)
136 abort ();
137 i = test3 (a, b, c, d);
138 if (i != 0)
139 abort ();
140 i = test4 (a, b, c, d);
141 if (i != 1)
142 abort ();
143 i = test5 (a, b, c, d);
144 if (i != 0)
145 abort ();
146 i = test6 (a, b, c, d);
147 if (i != 1)
148 abort ();
149 i = test7 (a, b, c, d);
150 if (i != 0)
151 abort ();
152 i = test8 (a, b, c, d);
153 if (i != 1)
154 abort ();
155 i = test9 (a, b, c, d);
156 if (i != 0)
157 abort ();
158 i = test10 (a, b, c, d);
159 if (i != 1)
160 abort ();
161 i = test11 (a, b, c, d);
162 if (i != 0)
163 abort ();
164 i = test12 (a, b, c, d);
165 if (i != 1)
166 abort ();
167 i = test13 (a, b, c, d);
168 if (i != 0)
169 abort ();
170 i = test14 (a, b, c, d);
171 if (i != 1)
172 abort ();
173 i = test15 (a, b, c, d);
174 if (i != 0)
175 abort ();
176 i = test16 (a, b, c, d);
177 if (i != 0)
178 abort ();
179 i = test17 (a, b, c, d);
180 if (i != 0)
181 abort ();
182 i = test18 (a, b, c, d);
183 if (i != 0)
184 abort ();
185 i = test19 (a, b, c, d);
186 if (i != 0)
187 abort ();
188 i = test20 (a, b, c, d);
189 if (i != 1)
190 abort ();
191 i = test21 (a, b, c, d);
192 if (i != 0)
193 abort ();
194 i = test22 (a, b, c, d);
195 if (i != 1)
196 abort ();
197 i = test23 (a, b, c, d);
198 if (i != 0)
199 abort ();
200 i = test24 (a, b, c, d);
201 if (i != 1)
202 abort ();
203 i = test25 (a, b, c, d);
204 if (i != 0)
205 abort ();
206 i = test26 (a, b, c, d);
207 if (i != 1)
208 abort ();
209 i = test27 (a, b, c, d);
210 if (i != 0)
211 abort ();
212 i = test28 (a, b, c, d);
213 if (i != 1)
214 abort ();
215 i = test29 (a, b, c, d);
216 if (i != 0)
217 abort ();
218 i = test30 (a, b, c, d);
219 if (i != 1)
220 abort ();
221 i = test31 (a, b, c, d);
222 if (i != 0)
223 abort ();
225 /* Reversed arguments */
226 i = test0 (b, a, d, c);
227 if (i != 0)
228 abort ();
229 i = test1 (b, a, d, c);
230 if (i != 0)
231 abort ();
232 i = test2 (b, a, d, c);
233 if (i != 0)
234 abort ();
235 i = test3 (b, a, d, c);
236 if (i != 0)
237 abort ();
238 i = test4 (b, a, d, c);
239 if (i != 1)
240 abort ();
241 i = test5 (b, a, d, c);
242 if (i != 0)
243 abort ();
244 i = test6 (b, a, d, c);
245 if (i != 1)
246 abort ();
247 i = test7 (b, a, d, c);
248 if (i != 0)
249 abort ();
250 i = test8 (b, a, d, c);
251 if (i != 1)
252 abort ();
253 i = test9 (b, a, d, c);
254 if (i != 0)
255 abort ();
256 i = test10 (b, a, d, c);
257 if (i != 1)
258 abort ();
259 i = test11 (b, a, d, c);
260 if (i != 0)
261 abort ();
262 i = test12 (b, a, d, c);
263 if (i != 1)
264 abort ();
265 i = test13 (b, a, d, c);
266 if (i != 0)
267 abort ();
268 i = test14 (b, a, d, c);
269 if (i != 1)
270 abort ();
271 i = test15 (b, a, d, c);
272 if (i != 0)
273 abort ();
274 i = test16 (b, a, d, c);
275 if (i != 0)
276 abort ();
277 i = test17 (b, a, d, c);
278 if (i != 0)
279 abort ();
280 i = test18 (b, a, d, c);
281 if (i != 0)
282 abort ();
283 i = test19 (b, a, d, c);
284 if (i != 0)
285 abort ();
286 i = test20 (b, a, d, c);
287 if (i != 1)
288 abort ();
289 i = test21 (b, a, d, c);
290 if (i != 0)
291 abort ();
292 i = test22 (b, a, d, c);
293 if (i != 1)
294 abort ();
295 i = test23 (b, a, d, c);
296 if (i != 0)
297 abort ();
298 i = test24 (b, a, d, c);
299 if (i != 1)
300 abort ();
301 i = test25 (b, a, d, c);
302 if (i != 0)
303 abort ();
304 i = test26 (b, a, d, c);
305 if (i != 1)
306 abort ();
307 i = test27 (b, a, d, c);
308 if (i != 0)
309 abort ();
310 i = test28 (b, a, d, c);
311 if (i != 1)
312 abort ();
313 i = test29 (b, a, d, c);
314 if (i != 0)
315 abort ();
316 i = test30 (b, a, d, c);
317 if (i != 1)
318 abort ();
319 i = test31 (b, a, d, c);
320 if (i != 0)
321 abort ();
323 #ifndef __FAST_MATH__
324 /* Test all comparisons */
325 a = (v2sf) {qnan, qnan};
326 b = (v2sf) {-33, -11};
327 c = (v2sf) {qnan, qnan};
328 d = (v2sf) {-55, -88};
330 i = test0 (a, b, c, d);
331 if (i != 0)
332 abort ();
333 i = test1 (a, b, c, d);
334 if (i != 0)
335 abort ();
336 i = test2 (a, b, c, d);
337 if (i != 1)
338 abort ();
339 i = test3 (a, b, c, d);
340 if (i != 1)
341 abort ();
342 i = test4 (a, b, c, d);
343 if (i != 0)
344 abort ();
345 i = test5 (a, b, c, d);
346 if (i != 0)
347 abort ();
348 i = test6 (a, b, c, d);
349 if (i != 1)
350 abort ();
351 i = test7 (a, b, c, d);
352 if (i != 1)
353 abort ();
354 i = test8 (a, b, c, d);
355 if (i != 0)
356 abort ();
357 i = test9 (a, b, c, d);
358 if (i != 0)
359 abort ();
360 i = test10 (a, b, c, d);
361 if (i != 1)
362 abort ();
363 i = test11 (a, b, c, d);
364 if (i != 1)
365 abort ();
366 i = test12 (a, b, c, d);
367 if (i != 0)
368 abort ();
369 i = test13 (a, b, c, d);
370 if (i != 0)
371 abort ();
372 i = test14 (a, b, c, d);
373 if (i != 1)
374 abort ();
375 i = test15 (a, b, c, d);
376 if (i != 1)
377 abort ();
378 i = test16 (a, b, c, d);
379 if (i != 0)
380 abort ();
381 i = test17 (a, b, c, d);
382 if (i != 0)
383 abort ();
384 i = test18 (a, b, c, d);
385 if (i != 1)
386 abort ();
387 i = test19 (a, b, c, d);
388 if (i != 1)
389 abort ();
390 i = test20 (a, b, c, d);
391 if (i != 0)
392 abort ();
393 i = test21 (a, b, c, d);
394 if (i != 0)
395 abort ();
396 i = test22 (a, b, c, d);
397 if (i != 1)
398 abort ();
399 i = test23 (a, b, c, d);
400 if (i != 1)
401 abort ();
402 i = test24 (a, b, c, d);
403 if (i != 0)
404 abort ();
405 i = test25 (a, b, c, d);
406 if (i != 0)
407 abort ();
408 i = test26 (a, b, c, d);
409 if (i != 1)
410 abort ();
411 i = test27 (a, b, c, d);
412 if (i != 1)
413 abort ();
414 i = test28 (a, b, c, d);
415 if (i != 0)
416 abort ();
417 i = test29 (a, b, c, d);
418 if (i != 0)
419 abort ();
420 i = test30 (a, b, c, d);
421 if (i != 1)
422 abort ();
423 i = test31 (a, b, c, d);
424 if (i != 1)
425 abort ();
426 #endif
428 printf ("Test Passes\n");
429 exit (0);
432 NOMIPS16 int test0 (v2sf a, v2sf b, v2sf c, v2sf d)
434 return __builtin_mips_any_cabs_f_4s (a, b, c, d);
437 NOMIPS16 int test1 (v2sf a, v2sf b, v2sf c, v2sf d)
439 return __builtin_mips_all_cabs_f_4s (a, b, c, d);
442 NOMIPS16 int test2 (v2sf a, v2sf b, v2sf c, v2sf d)
444 return __builtin_mips_any_cabs_un_4s (a, b, c, d);
447 NOMIPS16 int test3 (v2sf a, v2sf b, v2sf c, v2sf d)
449 return __builtin_mips_all_cabs_un_4s (a, b, c, d);
452 NOMIPS16 int test4 (v2sf a, v2sf b, v2sf c, v2sf d)
454 return __builtin_mips_any_cabs_eq_4s (a, b, c, d);
457 NOMIPS16 int test5 (v2sf a, v2sf b, v2sf c, v2sf d)
459 return __builtin_mips_all_cabs_eq_4s (a, b, c, d);
462 NOMIPS16 int test6 (v2sf a, v2sf b, v2sf c, v2sf d)
464 return __builtin_mips_any_cabs_ueq_4s (a, b, c, d);
467 NOMIPS16 int test7 (v2sf a, v2sf b, v2sf c, v2sf d)
469 return __builtin_mips_all_cabs_ueq_4s (a, b, c, d);
472 NOMIPS16 int test8 (v2sf a, v2sf b, v2sf c, v2sf d)
474 return __builtin_mips_any_cabs_olt_4s (a, b, c, d);
477 NOMIPS16 int test9 (v2sf a, v2sf b, v2sf c, v2sf d)
479 return __builtin_mips_all_cabs_olt_4s (a, b, c, d);
482 NOMIPS16 int test10 (v2sf a, v2sf b, v2sf c, v2sf d)
484 return __builtin_mips_any_cabs_ult_4s (a, b, c, d);
487 NOMIPS16 int test11 (v2sf a, v2sf b, v2sf c, v2sf d)
489 return __builtin_mips_all_cabs_ult_4s (a, b, c, d);
492 NOMIPS16 int test12 (v2sf a, v2sf b, v2sf c, v2sf d)
494 return __builtin_mips_any_cabs_ole_4s (a, b, c, d);
497 NOMIPS16 int test13 (v2sf a, v2sf b, v2sf c, v2sf d)
499 return __builtin_mips_all_cabs_ole_4s (a, b, c, d);
502 NOMIPS16 int test14 (v2sf a, v2sf b, v2sf c, v2sf d)
504 return __builtin_mips_any_cabs_ule_4s (a, b, c, d);
507 NOMIPS16 int test15 (v2sf a, v2sf b, v2sf c, v2sf d)
509 return __builtin_mips_all_cabs_ule_4s (a, b, c, d);
512 NOMIPS16 int test16 (v2sf a, v2sf b, v2sf c, v2sf d)
514 return __builtin_mips_any_cabs_sf_4s (a, b, c, d);
517 NOMIPS16 int test17 (v2sf a, v2sf b, v2sf c, v2sf d)
519 return __builtin_mips_all_cabs_sf_4s (a, b, c, d);
522 NOMIPS16 int test18 (v2sf a, v2sf b, v2sf c, v2sf d)
524 return __builtin_mips_any_cabs_ngle_4s (a, b, c, d);
527 NOMIPS16 int test19 (v2sf a, v2sf b, v2sf c, v2sf d)
529 return __builtin_mips_all_cabs_ngle_4s (a, b, c, d);
532 NOMIPS16 int test20 (v2sf a, v2sf b, v2sf c, v2sf d)
534 return __builtin_mips_any_cabs_seq_4s (a, b, c, d);
537 NOMIPS16 int test21 (v2sf a, v2sf b, v2sf c, v2sf d)
539 return __builtin_mips_all_cabs_seq_4s (a, b, c, d);
542 NOMIPS16 int test22 (v2sf a, v2sf b, v2sf c, v2sf d)
544 return __builtin_mips_any_cabs_ngl_4s (a, b, c, d);
547 NOMIPS16 int test23 (v2sf a, v2sf b, v2sf c, v2sf d)
549 return __builtin_mips_all_cabs_ngl_4s (a, b, c, d);
552 NOMIPS16 int test24 (v2sf a, v2sf b, v2sf c, v2sf d)
554 return __builtin_mips_any_cabs_lt_4s (a, b, c, d);
557 NOMIPS16 int test25 (v2sf a, v2sf b, v2sf c, v2sf d)
559 return __builtin_mips_all_cabs_lt_4s (a, b, c, d);
562 NOMIPS16 int test26 (v2sf a, v2sf b, v2sf c, v2sf d)
564 return __builtin_mips_any_cabs_nge_4s (a, b, c, d);
567 NOMIPS16 int test27 (v2sf a, v2sf b, v2sf c, v2sf d)
569 return __builtin_mips_all_cabs_nge_4s (a, b, c, d);
572 NOMIPS16 int test28 (v2sf a, v2sf b, v2sf c, v2sf d)
574 return __builtin_mips_any_cabs_le_4s (a, b, c, d);
577 NOMIPS16 int test29 (v2sf a, v2sf b, v2sf c, v2sf d)
579 return __builtin_mips_all_cabs_le_4s (a, b, c, d);
582 NOMIPS16 int test30 (v2sf a, v2sf b, v2sf c, v2sf d)
584 return __builtin_mips_any_cabs_ngt_4s (a, b, c, d);
587 NOMIPS16 int test31 (v2sf a, v2sf b, v2sf c, v2sf d)
589 return __builtin_mips_all_cabs_ngt_4s (a, b, c, d);