1 /* { dg-do run { target mipsisa64*-*-* } } */
2 /* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */
4 /* Test MIPS-3D absolute compare and conditional move builtin functions */
8 typedef float v2sf
__attribute__((vector_size(8)));
10 v2sf
test0 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
11 v2sf
test1 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
12 v2sf
test2 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
13 v2sf
test3 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
14 v2sf
test4 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
15 v2sf
test5 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
16 v2sf
test6 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
17 v2sf
test7 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
18 v2sf
test8 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
19 v2sf
test9 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
20 v2sf
test10 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
21 v2sf
test11 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
22 v2sf
test12 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
23 v2sf
test13 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
24 v2sf
test14 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
25 v2sf
test15 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
26 v2sf
test16 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
27 v2sf
test17 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
28 v2sf
test18 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
29 v2sf
test19 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
30 v2sf
test20 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
31 v2sf
test21 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
32 v2sf
test22 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
33 v2sf
test23 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
34 v2sf
test24 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
35 v2sf
test25 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
36 v2sf
test26 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
37 v2sf
test27 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
38 v2sf
test28 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
39 v2sf
test29 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
40 v2sf
test30 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
41 v2sf
test31 (v2sf a
, v2sf b
, v2sf c
, v2sf d
);
43 float qnan
= 1.0f
/0.0f
- 1.0f
/0.0f
;
47 v2sf a
, b
, c
, d
, e
, f
;
49 /* Case 1 {diff, diff} */
55 e
= __builtin_mips_movt_cabs_eq_ps (a
, b
, c
, d
);
57 if (!__builtin_mips_all_c_eq_ps (e
, f
))
61 e
= __builtin_mips_movf_cabs_eq_ps (a
, b
, c
, d
);
63 if (!__builtin_mips_all_c_eq_ps (e
, f
))
66 /* Case 2 {same, diff} */
72 e
= __builtin_mips_movt_cabs_eq_ps (a
, b
, c
, d
);
74 if (!__builtin_mips_all_c_eq_ps (e
, f
))
78 e
= __builtin_mips_movf_cabs_eq_ps (a
, b
, c
, d
);
80 if (!__builtin_mips_all_c_eq_ps (e
, f
))
83 /* Case 3 {diff, same} */
89 e
= __builtin_mips_movt_cabs_eq_ps (a
, b
, c
, d
);
91 if (!__builtin_mips_all_c_eq_ps (e
, f
))
95 e
= __builtin_mips_movf_cabs_eq_ps (a
, b
, c
, d
);
97 if (!__builtin_mips_all_c_eq_ps (e
, f
))
100 /* Case 4 {same, same} */
103 b
= (v2sf
) {-5, -12};
104 c
= (v2sf
) {33, 123};
106 e
= __builtin_mips_movt_cabs_eq_ps (a
, b
, c
, d
);
108 if (!__builtin_mips_all_c_eq_ps (e
, f
))
112 e
= __builtin_mips_movf_cabs_eq_ps (a
, b
, c
, d
);
113 f
= (v2sf
) {33, 123};
114 if (!__builtin_mips_all_c_eq_ps (e
, f
))
117 /* Test all 16 operators */
118 a
= (v2sf
) {-123, 123};
119 b
= (v2sf
) {1000, -1000};
120 c
= (v2sf
) {-33, 123};
123 e
= test0 (a
, b
, c
, d
);
124 if (!__builtin_mips_all_c_eq_ps (e
, c
))
126 e
= test1 (a
, b
, c
, d
);
127 if (!__builtin_mips_all_c_eq_ps (e
, d
))
130 e
= test2 (a
, b
, c
, d
);
131 if (!__builtin_mips_all_c_eq_ps (e
, c
))
133 e
= test3 (a
, b
, c
, d
);
134 if (!__builtin_mips_all_c_eq_ps (e
, d
))
137 e
= test4 (a
, b
, c
, d
);
138 if (!__builtin_mips_all_c_eq_ps (e
, c
))
140 e
= test5 (a
, b
, c
, d
);
141 if (!__builtin_mips_all_c_eq_ps (e
, d
))
144 e
= test6 (a
, b
, c
, d
);
145 if (!__builtin_mips_all_c_eq_ps (e
, c
))
147 e
= test7 (a
, b
, c
, d
);
148 if (!__builtin_mips_all_c_eq_ps (e
, d
))
151 e
= test8 (a
, b
, c
, d
);
152 if (!__builtin_mips_all_c_eq_ps (e
, d
))
154 e
= test9 (a
, b
, c
, d
);
155 if (!__builtin_mips_all_c_eq_ps (e
, c
))
158 e
= test10 (a
, b
, c
, d
);
159 if (!__builtin_mips_all_c_eq_ps (e
, d
))
161 e
= test11 (a
, b
, c
, d
);
162 if (!__builtin_mips_all_c_eq_ps (e
, c
))
165 e
= test12 (a
, b
, c
, d
);
166 if (!__builtin_mips_all_c_eq_ps (e
, d
))
168 e
= test13 (a
, b
, c
, d
);
169 if (!__builtin_mips_all_c_eq_ps (e
, c
))
172 e
= test14 (a
, b
, c
, d
);
173 if (!__builtin_mips_all_c_eq_ps (e
, d
))
175 e
= test15 (a
, b
, c
, d
);
176 if (!__builtin_mips_all_c_eq_ps (e
, c
))
179 e
= test16 (a
, b
, c
, d
);
180 if (!__builtin_mips_all_c_eq_ps (e
, c
))
182 e
= test17 (a
, b
, c
, d
);
183 if (!__builtin_mips_all_c_eq_ps (e
, d
))
186 e
= test18 (a
, b
, c
, d
);
187 if (!__builtin_mips_all_c_eq_ps (e
, c
))
189 e
= test19 (a
, b
, c
, d
);
190 if (!__builtin_mips_all_c_eq_ps (e
, d
))
193 e
= test20 (a
, b
, c
, d
);
194 if (!__builtin_mips_all_c_eq_ps (e
, c
))
196 e
= test21 (a
, b
, c
, d
);
197 if (!__builtin_mips_all_c_eq_ps (e
, d
))
200 e
= test22 (a
, b
, c
, d
);
201 if (!__builtin_mips_all_c_eq_ps (e
, c
))
203 e
= test23 (a
, b
, c
, d
);
204 if (!__builtin_mips_all_c_eq_ps (e
, d
))
207 e
= test24 (a
, b
, c
, d
);
208 if (!__builtin_mips_all_c_eq_ps (e
, d
))
210 e
= test25 (a
, b
, c
, d
);
211 if (!__builtin_mips_all_c_eq_ps (e
, c
))
214 e
= test26 (a
, b
, c
, d
);
215 if (!__builtin_mips_all_c_eq_ps (e
, d
))
217 e
= test27 (a
, b
, c
, d
);
218 if (!__builtin_mips_all_c_eq_ps (e
, c
))
221 e
= test28 (a
, b
, c
, d
);
222 if (!__builtin_mips_all_c_eq_ps (e
, d
))
224 e
= test29 (a
, b
, c
, d
);
225 if (!__builtin_mips_all_c_eq_ps (e
, c
))
228 e
= test30 (a
, b
, c
, d
);
229 if (!__builtin_mips_all_c_eq_ps (e
, d
))
231 e
= test31 (a
, b
, c
, d
);
232 if (!__builtin_mips_all_c_eq_ps (e
, c
))
235 /* Reversed arguments */
236 e
= test0 (b
, a
, c
, d
);
237 if (!__builtin_mips_all_c_eq_ps (e
, c
))
239 e
= test1 (b
, a
, c
, d
);
240 if (!__builtin_mips_all_c_eq_ps (e
, d
))
243 e
= test2 (b
, a
, c
, d
);
244 if (!__builtin_mips_all_c_eq_ps (e
, c
))
246 e
= test3 (b
, a
, c
, d
);
247 if (!__builtin_mips_all_c_eq_ps (e
, d
))
250 e
= test4 (b
, a
, c
, d
);
251 if (!__builtin_mips_all_c_eq_ps (e
, c
))
253 e
= test5 (b
, a
, c
, d
);
254 if (!__builtin_mips_all_c_eq_ps (e
, d
))
257 e
= test6 (b
, a
, c
, d
);
258 if (!__builtin_mips_all_c_eq_ps (e
, c
))
260 e
= test7 (b
, a
, c
, d
);
261 if (!__builtin_mips_all_c_eq_ps (e
, d
))
264 e
= test8 (b
, a
, c
, d
);
265 if (!__builtin_mips_all_c_eq_ps (e
, c
))
267 e
= test9 (b
, a
, c
, d
);
268 if (!__builtin_mips_all_c_eq_ps (e
, d
))
271 e
= test10 (b
, a
, c
, d
);
272 if (!__builtin_mips_all_c_eq_ps (e
, c
))
274 e
= test11 (b
, a
, c
, d
);
275 if (!__builtin_mips_all_c_eq_ps (e
, d
))
278 e
= test12 (b
, a
, c
, d
);
279 if (!__builtin_mips_all_c_eq_ps (e
, c
))
281 e
= test13 (b
, a
, c
, d
);
282 if (!__builtin_mips_all_c_eq_ps (e
, d
))
285 e
= test14 (b
, a
, c
, d
);
286 if (!__builtin_mips_all_c_eq_ps (e
, c
))
288 e
= test15 (b
, a
, c
, d
);
289 if (!__builtin_mips_all_c_eq_ps (e
, d
))
292 e
= test16 (b
, a
, c
, d
);
293 if (!__builtin_mips_all_c_eq_ps (e
, c
))
295 e
= test17 (b
, a
, c
, d
);
296 if (!__builtin_mips_all_c_eq_ps (e
, d
))
299 e
= test18 (b
, a
, c
, d
);
300 if (!__builtin_mips_all_c_eq_ps (e
, c
))
302 e
= test19 (b
, a
, c
, d
);
303 if (!__builtin_mips_all_c_eq_ps (e
, d
))
306 e
= test20 (b
, a
, c
, d
);
307 if (!__builtin_mips_all_c_eq_ps (e
, c
))
309 e
= test21 (b
, a
, c
, d
);
310 if (!__builtin_mips_all_c_eq_ps (e
, d
))
313 e
= test22 (b
, a
, c
, d
);
314 if (!__builtin_mips_all_c_eq_ps (e
, c
))
316 e
= test23 (b
, a
, c
, d
);
317 if (!__builtin_mips_all_c_eq_ps (e
, d
))
320 e
= test24 (b
, a
, c
, d
);
321 if (!__builtin_mips_all_c_eq_ps (e
, c
))
323 e
= test25 (b
, a
, c
, d
);
324 if (!__builtin_mips_all_c_eq_ps (e
, d
))
327 e
= test26 (b
, a
, c
, d
);
328 if (!__builtin_mips_all_c_eq_ps (e
, c
))
330 e
= test27 (b
, a
, c
, d
);
331 if (!__builtin_mips_all_c_eq_ps (e
, d
))
334 e
= test28 (b
, a
, c
, d
);
335 if (!__builtin_mips_all_c_eq_ps (e
, c
))
337 e
= test29 (b
, a
, c
, d
);
338 if (!__builtin_mips_all_c_eq_ps (e
, d
))
341 e
= test30 (b
, a
, c
, d
);
342 if (!__builtin_mips_all_c_eq_ps (e
, c
))
344 e
= test31 (b
, a
, c
, d
);
345 if (!__builtin_mips_all_c_eq_ps (e
, d
))
348 #ifndef __FAST_MATH__
349 /* Test all 16 operators */
350 a
= (v2sf
) {qnan
, qnan
};
351 b
= (v2sf
) {1000, -1000};
353 d
= (v2sf
) {-33, 123};
355 e
= test0 (a
, b
, c
, d
);
356 if (!__builtin_mips_all_c_eq_ps (e
, c
))
358 e
= test1 (a
, b
, c
, d
);
359 if (!__builtin_mips_all_c_eq_ps (e
, d
))
362 e
= test2 (a
, b
, c
, d
);
363 if (!__builtin_mips_all_c_eq_ps (e
, d
))
365 e
= test3 (a
, b
, c
, d
);
366 if (!__builtin_mips_all_c_eq_ps (e
, c
))
369 e
= test4 (a
, b
, c
, d
);
370 if (!__builtin_mips_all_c_eq_ps (e
, c
))
372 e
= test5 (a
, b
, c
, d
);
373 if (!__builtin_mips_all_c_eq_ps (e
, d
))
376 e
= test6 (a
, b
, c
, d
);
377 if (!__builtin_mips_all_c_eq_ps (e
, d
))
379 e
= test7 (a
, b
, c
, d
);
380 if (!__builtin_mips_all_c_eq_ps (e
, c
))
383 e
= test8 (a
, b
, c
, d
);
384 if (!__builtin_mips_all_c_eq_ps (e
, c
))
386 e
= test9 (a
, b
, c
, d
);
387 if (!__builtin_mips_all_c_eq_ps (e
, d
))
390 e
= test10 (a
, b
, c
, d
);
391 if (!__builtin_mips_all_c_eq_ps (e
, d
))
393 e
= test11 (a
, b
, c
, d
);
394 if (!__builtin_mips_all_c_eq_ps (e
, c
))
397 e
= test12 (a
, b
, c
, d
);
398 if (!__builtin_mips_all_c_eq_ps (e
, c
))
400 e
= test13 (a
, b
, c
, d
);
401 if (!__builtin_mips_all_c_eq_ps (e
, d
))
404 e
= test14 (a
, b
, c
, d
);
405 if (!__builtin_mips_all_c_eq_ps (e
, d
))
407 e
= test15 (a
, b
, c
, d
);
408 if (!__builtin_mips_all_c_eq_ps (e
, c
))
411 e
= test16 (a
, b
, c
, d
);
412 if (!__builtin_mips_all_c_eq_ps (e
, c
))
414 e
= test17 (a
, b
, c
, d
);
415 if (!__builtin_mips_all_c_eq_ps (e
, d
))
418 e
= test18 (a
, b
, c
, d
);
419 if (!__builtin_mips_all_c_eq_ps (e
, d
))
421 e
= test19 (a
, b
, c
, d
);
422 if (!__builtin_mips_all_c_eq_ps (e
, c
))
425 e
= test20 (a
, b
, c
, d
);
426 if (!__builtin_mips_all_c_eq_ps (e
, c
))
428 e
= test21 (a
, b
, c
, d
);
429 if (!__builtin_mips_all_c_eq_ps (e
, d
))
432 e
= test22 (a
, b
, c
, d
);
433 if (!__builtin_mips_all_c_eq_ps (e
, d
))
435 e
= test23 (a
, b
, c
, d
);
436 if (!__builtin_mips_all_c_eq_ps (e
, c
))
439 e
= test24 (a
, b
, c
, d
);
440 if (!__builtin_mips_all_c_eq_ps (e
, c
))
442 e
= test25 (a
, b
, c
, d
);
443 if (!__builtin_mips_all_c_eq_ps (e
, d
))
446 e
= test26 (a
, b
, c
, d
);
447 if (!__builtin_mips_all_c_eq_ps (e
, d
))
449 e
= test27 (a
, b
, c
, d
);
450 if (!__builtin_mips_all_c_eq_ps (e
, c
))
453 e
= test28 (a
, b
, c
, d
);
454 if (!__builtin_mips_all_c_eq_ps (e
, c
))
456 e
= test29 (a
, b
, c
, d
);
457 if (!__builtin_mips_all_c_eq_ps (e
, d
))
460 e
= test30 (a
, b
, c
, d
);
461 if (!__builtin_mips_all_c_eq_ps (e
, d
))
463 e
= test31 (a
, b
, c
, d
);
464 if (!__builtin_mips_all_c_eq_ps (e
, c
))
468 printf ("Test Passes\n");
472 v2sf
test0 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
474 return __builtin_mips_movt_cabs_f_ps (a
, b
, c
, d
);
477 v2sf
test1 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
479 return __builtin_mips_movf_cabs_f_ps (a
, b
, c
, d
);
482 v2sf
test2 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
484 return __builtin_mips_movt_cabs_un_ps (a
, b
, c
, d
);
487 v2sf
test3 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
489 return __builtin_mips_movf_cabs_un_ps (a
, b
, c
, d
);
492 v2sf
test4 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
494 return __builtin_mips_movt_cabs_eq_ps (a
, b
, c
, d
);
497 v2sf
test5 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
499 return __builtin_mips_movf_cabs_eq_ps (a
, b
, c
, d
);
502 v2sf
test6 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
504 return __builtin_mips_movt_cabs_ueq_ps (a
, b
, c
, d
);
507 v2sf
test7 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
509 return __builtin_mips_movf_cabs_ueq_ps (a
, b
, c
, d
);
512 v2sf
test8 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
514 return __builtin_mips_movt_cabs_olt_ps (a
, b
, c
, d
);
517 v2sf
test9 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
519 return __builtin_mips_movf_cabs_olt_ps (a
, b
, c
, d
);
522 v2sf
test10 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
524 return __builtin_mips_movt_cabs_ult_ps (a
, b
, c
, d
);
527 v2sf
test11 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
529 return __builtin_mips_movf_cabs_ult_ps (a
, b
, c
, d
);
532 v2sf
test12 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
534 return __builtin_mips_movt_cabs_ole_ps (a
, b
, c
, d
);
537 v2sf
test13 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
539 return __builtin_mips_movf_cabs_ole_ps (a
, b
, c
, d
);
542 v2sf
test14 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
544 return __builtin_mips_movt_cabs_ule_ps (a
, b
, c
, d
);
547 v2sf
test15 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
549 return __builtin_mips_movf_cabs_ule_ps (a
, b
, c
, d
);
552 v2sf
test16 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
554 return __builtin_mips_movt_cabs_sf_ps (a
, b
, c
, d
);
557 v2sf
test17 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
559 return __builtin_mips_movf_cabs_sf_ps (a
, b
, c
, d
);
562 v2sf
test18 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
564 return __builtin_mips_movt_cabs_ngle_ps (a
, b
, c
, d
);
567 v2sf
test19 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
569 return __builtin_mips_movf_cabs_ngle_ps (a
, b
, c
, d
);
572 v2sf
test20 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
574 return __builtin_mips_movt_cabs_seq_ps (a
, b
, c
, d
);
577 v2sf
test21 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
579 return __builtin_mips_movf_cabs_seq_ps (a
, b
, c
, d
);
582 v2sf
test22 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
584 return __builtin_mips_movt_cabs_ngl_ps (a
, b
, c
, d
);
587 v2sf
test23 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
589 return __builtin_mips_movf_cabs_ngl_ps (a
, b
, c
, d
);
592 v2sf
test24 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
594 return __builtin_mips_movt_cabs_lt_ps (a
, b
, c
, d
);
597 v2sf
test25 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
599 return __builtin_mips_movf_cabs_lt_ps (a
, b
, c
, d
);
602 v2sf
test26 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
604 return __builtin_mips_movt_cabs_nge_ps (a
, b
, c
, d
);
607 v2sf
test27 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
609 return __builtin_mips_movf_cabs_nge_ps (a
, b
, c
, d
);
612 v2sf
test28 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
614 return __builtin_mips_movt_cabs_le_ps (a
, b
, c
, d
);
617 v2sf
test29 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
619 return __builtin_mips_movf_cabs_le_ps (a
, b
, c
, d
);
622 v2sf
test30 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
624 return __builtin_mips_movt_cabs_ngt_ps (a
, b
, c
, d
);
627 v2sf
test31 (v2sf a
, v2sf b
, v2sf c
, v2sf d
)
629 return __builtin_mips_movf_cabs_ngt_ps (a
, b
, c
, d
);