Handle Octeon 3 not supporting MIPS paired-single instructions.
[official-gcc.git] / gcc / testsuite / gcc.target / mips / mips-3d-2.c
blob4da059f9ec076175b430fb311a0684a905fe1290
1 /* { dg-do run } */
2 /* { dg-options "-mips3d forbid_cpu=octeon.*" } */
4 /* Test MIPS-3D branch-if-any-two 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);
11 NOMIPS16 int test1 (v2sf a, v2sf b);
12 NOMIPS16 int test2 (v2sf a, v2sf b);
13 NOMIPS16 int test3 (v2sf a, v2sf b);
14 NOMIPS16 int test4 (v2sf a, v2sf b);
15 NOMIPS16 int test5 (v2sf a, v2sf b);
16 NOMIPS16 int test6 (v2sf a, v2sf b);
17 NOMIPS16 int test7 (v2sf a, v2sf b);
18 NOMIPS16 int test8 (v2sf a, v2sf b);
19 NOMIPS16 int test9 (v2sf a, v2sf b);
20 NOMIPS16 int test10 (v2sf a, v2sf b);
21 NOMIPS16 int test11 (v2sf a, v2sf b);
22 NOMIPS16 int test12 (v2sf a, v2sf b);
23 NOMIPS16 int test13 (v2sf a, v2sf b);
24 NOMIPS16 int test14 (v2sf a, v2sf b);
25 NOMIPS16 int test15 (v2sf a, v2sf b);
26 NOMIPS16 int test16 (v2sf a, v2sf b);
27 NOMIPS16 int test17 (v2sf a, v2sf b);
28 NOMIPS16 int test18 (v2sf a, v2sf b);
29 NOMIPS16 int test19 (v2sf a, v2sf b);
30 NOMIPS16 int test20 (v2sf a, v2sf b);
31 NOMIPS16 int test21 (v2sf a, v2sf b);
32 NOMIPS16 int test22 (v2sf a, v2sf b);
33 NOMIPS16 int test23 (v2sf a, v2sf b);
34 NOMIPS16 int test24 (v2sf a, v2sf b);
35 NOMIPS16 int test25 (v2sf a, v2sf b);
36 NOMIPS16 int test26 (v2sf a, v2sf b);
37 NOMIPS16 int test27 (v2sf a, v2sf b);
38 NOMIPS16 int test28 (v2sf a, v2sf b);
39 NOMIPS16 int test29 (v2sf a, v2sf b);
40 NOMIPS16 int test30 (v2sf a, v2sf b);
41 NOMIPS16 int test31 (v2sf a, v2sf b);
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 /* c.eq.ps */
51 a = (v2sf) {12, 34};
52 b = (v2sf) {56, 78};
53 i = 0;
54 j = 0;
55 if (__builtin_mips_any_c_eq_ps(a, b) != i)
56 abort ();
57 if (__builtin_mips_all_c_eq_ps(a, b) != j)
58 abort ();
60 /* c.eq.ps */
61 a = (v2sf) {12, 34};
62 b = (v2sf) {12, 78};
63 i = 1;
64 j = 0;
65 if (__builtin_mips_any_c_eq_ps(a, b) != i)
66 abort ();
67 if (__builtin_mips_all_c_eq_ps(a, b) != j)
68 abort ();
70 /* c.eq.ps */
71 a = (v2sf) {12, 34};
72 b = (v2sf) {56, 34};
73 i = 1;
74 j = 0;
75 if (__builtin_mips_any_c_eq_ps(a, b) != i)
76 abort ();
77 if (__builtin_mips_all_c_eq_ps(a, b) != j)
78 abort ();
80 /* c.eq.ps */
81 a = (v2sf) {12, 34};
82 b = (v2sf) {12, 34};
83 i = 1;
84 j = 1;
85 if (__builtin_mips_any_c_eq_ps(a, b) != i)
86 abort ();
87 if (__builtin_mips_all_c_eq_ps(a, b) != j)
88 abort ();
90 /* Test with 16 operators */
91 a = (v2sf) {10.58, 1984.0};
92 b = (v2sf) {567.345, 1984.0};
94 i = test0 (a, b);
95 if (i != 0)
96 abort ();
97 i = test1 (a, b);
98 if (i != 0)
99 abort ();
100 i = test2 (a, b);
101 if (i != 0)
102 abort ();
103 i = test3 (a, b);
104 if (i != 0)
105 abort ();
106 i = test4 (a, b);
107 if (i != 1)
108 abort ();
109 i = test5 (a, b);
110 if (i != 0)
111 abort ();
112 i = test6 (a, b);
113 if (i != 1)
114 abort ();
115 i = test7 (a, b);
116 if (i != 0)
117 abort ();
118 i = test8 (a, b);
119 if (i != 1)
120 abort ();
121 i = test9 (a, b);
122 if (i != 0)
123 abort ();
124 i = test10 (a, b);
125 if (i != 1)
126 abort ();
127 i = test11 (a, b);
128 if (i != 0)
129 abort ();
130 i = test12 (a, b);
131 if (i != 1)
132 abort ();
133 i = test13 (a, b);
134 if (i != 1)
135 abort ();
136 i = test14 (a, b);
137 if (i != 1)
138 abort ();
139 i = test15 (a, b);
140 if (i != 1)
141 abort ();
142 i = test16 (a, b);
143 if (i != 0)
144 abort ();
145 i = test17 (a, b);
146 if (i != 0)
147 abort ();
148 i = test18 (a, b);
149 if (i != 0)
150 abort ();
151 i = test19 (a, b);
152 if (i != 0)
153 abort ();
154 i = test20 (a, b);
155 if (i != 1)
156 abort ();
157 i = test21 (a, b);
158 if (i != 0)
159 abort ();
160 i = test22 (a, b);
161 if (i != 1)
162 abort ();
163 i = test23 (a, b);
164 if (i != 0)
165 abort ();
166 i = test24 (a, b);
167 if (i != 1)
168 abort ();
169 i = test25 (a, b);
170 if (i != 0)
171 abort ();
172 i = test26 (a, b);
173 if (i != 1)
174 abort ();
175 i = test27 (a, b);
176 if (i != 0)
177 abort ();
178 i = test28 (a, b);
179 if (i != 1)
180 abort ();
181 i = test29 (a, b);
182 if (i != 1)
183 abort ();
184 i = test30 (a, b);
185 if (i != 1)
186 abort ();
187 i = test31 (a, b);
188 if (i != 1)
189 abort ();
191 /* Reverse arguments */
192 i = test0 (b, a);
193 if (i != 0)
194 abort ();
195 i = test1 (b, a);
196 if (i != 0)
197 abort ();
198 i = test2 (b, a);
199 if (i != 0)
200 abort ();
201 i = test3 (b, a);
202 if (i != 0)
203 abort ();
204 i = test4 (b, a);
205 if (i != 1)
206 abort ();
207 i = test5 (b, a);
208 if (i != 0)
209 abort ();
210 i = test6 (b, a);
211 if (i != 1)
212 abort ();
213 i = test7 (b, a);
214 if (i != 0)
215 abort ();
216 i = test8 (b, a);
217 if (i != 0)
218 abort ();
219 i = test9 (b, a);
220 if (i != 0)
221 abort ();
222 i = test10 (b, a);
223 if (i != 0)
224 abort ();
225 i = test11 (b, a);
226 if (i != 0)
227 abort ();
228 i = test12 (b, a);
229 if (i != 1)
230 abort ();
231 i = test13 (b, a);
232 if (i != 0)
233 abort ();
234 i = test14 (b, a);
235 if (i != 1)
236 abort ();
237 i = test15 (b, a);
238 if (i != 0)
239 abort ();
240 i = test16 (b, a);
241 if (i != 0)
242 abort ();
243 i = test17 (b, a);
244 if (i != 0)
245 abort ();
246 i = test18 (b, a);
247 if (i != 0)
248 abort ();
249 i = test19 (b, a);
250 if (i != 0)
251 abort ();
252 i = test20 (b, a);
253 if (i != 1)
254 abort ();
255 i = test21 (b, a);
256 if (i != 0)
257 abort ();
258 i = test22 (b, a);
259 if (i != 1)
260 abort ();
261 i = test23 (b, a);
262 if (i != 0)
263 abort ();
264 i = test24 (b, a);
265 if (i != 0)
266 abort ();
267 i = test25 (b, a);
268 if (i != 0)
269 abort ();
270 i = test26 (b, a);
271 if (i != 0)
272 abort ();
273 i = test27 (b, a);
274 if (i != 0)
275 abort ();
276 i = test28 (b, a);
277 if (i != 1)
278 abort ();
279 i = test29 (b, a);
280 if (i != 0)
281 abort ();
282 i = test30 (b, a);
283 if (i != 1)
284 abort ();
285 i = test31 (b, a);
286 if (i != 0)
287 abort ();
289 #ifndef __FAST_MATH__
290 /* Test with 16 operators */
291 a = (v2sf) {qnan, qnan};
292 b = (v2sf) {567.345, 1984.0};
294 i = test0 (a, b);
295 if (i != 0)
296 abort ();
297 i = test1 (a, b);
298 if (i != 0)
299 abort ();
300 i = test2 (a, b);
301 if (i != 1)
302 abort ();
303 i = test3 (a, b);
304 if (i != 1)
305 abort ();
306 i = test4 (a, b);
307 if (i != 0)
308 abort ();
309 i = test5 (a, b);
310 if (i != 0)
311 abort ();
312 i = test6 (a, b);
313 if (i != 1)
314 abort ();
315 i = test7 (a, b);
316 if (i != 1)
317 abort ();
318 i = test8 (a, b);
319 if (i != 0)
320 abort ();
321 i = test9 (a, b);
322 if (i != 0)
323 abort ();
324 i = test10 (a, b);
325 if (i != 1)
326 abort ();
327 i = test11 (a, b);
328 if (i != 1)
329 abort ();
330 i = test12 (a, b);
331 if (i != 0)
332 abort ();
333 i = test13 (a, b);
334 if (i != 0)
335 abort ();
336 i = test14 (a, b);
337 if (i != 1)
338 abort ();
339 i = test15 (a, b);
340 if (i != 1)
341 abort ();
342 i = test16 (a, b);
343 if (i != 0)
344 abort ();
345 i = test17 (a, b);
346 if (i != 0)
347 abort ();
348 i = test18 (a, b);
349 if (i != 1)
350 abort ();
351 i = test19 (a, b);
352 if (i != 1)
353 abort ();
354 i = test20 (a, b);
355 if (i != 0)
356 abort ();
357 i = test21 (a, b);
358 if (i != 0)
359 abort ();
360 i = test22 (a, b);
361 if (i != 1)
362 abort ();
363 i = test23 (a, b);
364 if (i != 1)
365 abort ();
366 i = test24 (a, b);
367 if (i != 0)
368 abort ();
369 i = test25 (a, b);
370 if (i != 0)
371 abort ();
372 i = test26 (a, b);
373 if (i != 1)
374 abort ();
375 i = test27 (a, b);
376 if (i != 1)
377 abort ();
378 i = test28 (a, b);
379 if (i != 0)
380 abort ();
381 i = test29 (a, b);
382 if (i != 0)
383 abort ();
384 i = test30 (a, b);
385 if (i != 1)
386 abort ();
387 i = test31 (a, b);
388 if (i != 1)
389 abort ();
390 #endif
392 printf ("Test Passes\n");
393 exit (0);
396 NOMIPS16 int test0 (v2sf a, v2sf b)
398 return __builtin_mips_any_c_f_ps (a, b);
401 NOMIPS16 int test1 (v2sf a, v2sf b)
403 return __builtin_mips_all_c_f_ps (a, b);
406 NOMIPS16 int test2 (v2sf a, v2sf b)
408 return __builtin_mips_any_c_un_ps (a, b);
411 NOMIPS16 int test3 (v2sf a, v2sf b)
413 return __builtin_mips_all_c_un_ps (a, b);
416 NOMIPS16 int test4 (v2sf a, v2sf b)
418 return __builtin_mips_any_c_eq_ps (a, b);
421 NOMIPS16 int test5 (v2sf a, v2sf b)
423 return __builtin_mips_all_c_eq_ps (a, b);
426 NOMIPS16 int test6 (v2sf a, v2sf b)
428 return __builtin_mips_any_c_ueq_ps (a, b);
431 NOMIPS16 int test7 (v2sf a, v2sf b)
433 return __builtin_mips_all_c_ueq_ps (a, b);
436 NOMIPS16 int test8 (v2sf a, v2sf b)
438 return __builtin_mips_any_c_olt_ps (a, b);
441 NOMIPS16 int test9 (v2sf a, v2sf b)
443 return __builtin_mips_all_c_olt_ps (a, b);
446 NOMIPS16 int test10 (v2sf a, v2sf b)
448 return __builtin_mips_any_c_ult_ps (a, b);
451 NOMIPS16 int test11 (v2sf a, v2sf b)
453 return __builtin_mips_all_c_ult_ps (a, b);
456 NOMIPS16 int test12 (v2sf a, v2sf b)
458 return __builtin_mips_any_c_ole_ps (a, b);
461 NOMIPS16 int test13 (v2sf a, v2sf b)
463 return __builtin_mips_all_c_ole_ps (a, b);
466 NOMIPS16 int test14 (v2sf a, v2sf b)
468 return __builtin_mips_any_c_ule_ps (a, b);
471 NOMIPS16 int test15 (v2sf a, v2sf b)
473 return __builtin_mips_all_c_ule_ps (a, b);
476 NOMIPS16 int test16 (v2sf a, v2sf b)
478 return __builtin_mips_any_c_sf_ps (a, b);
481 NOMIPS16 int test17 (v2sf a, v2sf b)
483 return __builtin_mips_all_c_sf_ps (a, b);
486 NOMIPS16 int test18 (v2sf a, v2sf b)
488 return __builtin_mips_any_c_ngle_ps (a, b);
491 NOMIPS16 int test19 (v2sf a, v2sf b)
493 return __builtin_mips_all_c_ngle_ps (a, b);
496 NOMIPS16 int test20 (v2sf a, v2sf b)
498 return __builtin_mips_any_c_seq_ps (a, b);
501 NOMIPS16 int test21 (v2sf a, v2sf b)
503 return __builtin_mips_all_c_seq_ps (a, b);
506 NOMIPS16 int test22 (v2sf a, v2sf b)
508 return __builtin_mips_any_c_ngl_ps (a, b);
511 NOMIPS16 int test23 (v2sf a, v2sf b)
513 return __builtin_mips_all_c_ngl_ps (a, b);
516 NOMIPS16 int test24 (v2sf a, v2sf b)
518 return __builtin_mips_any_c_lt_ps (a, b);
521 NOMIPS16 int test25 (v2sf a, v2sf b)
523 return __builtin_mips_all_c_lt_ps (a, b);
526 NOMIPS16 int test26 (v2sf a, v2sf b)
528 return __builtin_mips_any_c_nge_ps (a, b);
531 NOMIPS16 int test27 (v2sf a, v2sf b)
533 return __builtin_mips_all_c_nge_ps (a, b);
536 NOMIPS16 int test28 (v2sf a, v2sf b)
538 return __builtin_mips_any_c_le_ps (a, b);
541 NOMIPS16 int test29 (v2sf a, v2sf b)
543 return __builtin_mips_all_c_le_ps (a, b);
546 NOMIPS16 int test30 (v2sf a, v2sf b)
548 return __builtin_mips_any_c_ngt_ps (a, b);
551 NOMIPS16 int test31 (v2sf a, v2sf b)
553 return __builtin_mips_all_c_ngt_ps (a, b);