Stop only if there aren't any usable algorithms
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx-vcmpss-1.c
blob0dd1b09228e5d9e51d33c6f1cbab35be690606ff
1 /* { dg-do run } */
2 /* { dg-require-effective-target avx } */
3 /* { dg-require-effective-target c99_runtime } */
4 /* { dg-options "-O2 -mavx -std=c99" } */
6 #include "avx-check.h"
7 #include <math.h>
9 float s1[]={2134.3343, 6678.346, 453.345635, 54646.464356};
10 float s2[]={41124.234, 6678.346, 8653.65635, 856.43576};
11 int dd[] = {1, 2, 3, 4};
12 float d[4];
13 union{int i[4]; float f[4];} e;
15 void check(unsigned imm, char *id)
17 if(checkVi((int*)d, e.i, 4)){
18 printf("mm_cmp_ss(0x%x, %s) FAILED\n", imm, id);
22 static void
23 avx_test ()
25 __m128 source1, source2, dest;
26 int i;
28 #define CMP(imm, rel) \
29 e.i[0] = rel ? -1 : 0; \
30 dest = _mm_loadu_ps((float*)dd); \
31 source1 = _mm_loadu_ps(s1); \
32 source2 = _mm_loadu_ps(s2); \
33 dest = _mm_cmp_ss(source1, source2, imm); \
34 _mm_storeu_ps(d, dest); \
35 check(imm, "" #imm "");
37 for(i = 1; i < 4; i++) e.f[i] = s1[i];
39 CMP(_CMP_EQ_OQ, !isunordered(s1[0], s2[0]) && s1[0] == s2[0]);
40 CMP(_CMP_LT_OS, !isunordered(s1[0], s2[0]) && s1[0] < s2[0]);
41 CMP(_CMP_LE_OS, !isunordered(s1[0], s2[0]) && s1[0] <= s2[0]);
42 CMP(_CMP_UNORD_Q, isunordered(s1[0], s2[0]));
43 CMP(_CMP_NEQ_UQ, isunordered(s1[0], s2[0]) || s1[0] != s2[0]);
44 CMP(_CMP_NLT_US, isunordered(s1[0], s2[0]) || s1[0] >= s2[0]);
45 CMP(_CMP_NLE_US, isunordered(s1[0], s2[0]) || s1[0] > s2[0]);
46 CMP(_CMP_ORD_Q, !isunordered(s1[0], s2[0]));
48 CMP(_CMP_EQ_UQ, isunordered(s1[0], s2[0]) || s1[0] == s2[0]);
49 CMP(_CMP_NGE_US, isunordered(s1[0], s2[0]) || s1[0] < s2[0]);
50 CMP(_CMP_NGT_US, isunordered(s1[0], s2[0]) || s1[0] <= s2[0]);
52 CMP(_CMP_FALSE_OQ, 0);
53 CMP(_CMP_NEQ_OQ, !isunordered(s1[0], s2[0]) && s1[0] != s2[0]);
54 CMP(_CMP_GE_OS, !isunordered(s1[0], s2[0]) && s1[0] >= s2[0]);
55 CMP(_CMP_GT_OS, !isunordered(s1[0], s2[0]) && s1[0] > s2[0]);
56 CMP(_CMP_TRUE_UQ, 1);
58 CMP(_CMP_EQ_OS, !isunordered(s1[0], s2[0]) && s1[0] == s2[0]);
59 CMP(_CMP_LT_OQ, !isunordered(s1[0], s2[0]) && s1[0] < s2[0]);
60 CMP(_CMP_LE_OQ, !isunordered(s1[0], s2[0]) && s1[0] <= s2[0]);
61 CMP(_CMP_UNORD_S, isunordered(s1[0], s2[0]));
62 CMP(_CMP_NEQ_US, isunordered(s1[0], s2[0]) || s1[0] != s2[0]);
63 CMP(_CMP_NLT_UQ, isunordered(s1[0], s2[0]) || s1[0] >= s2[0]);
64 CMP(_CMP_NLE_UQ, isunordered(s1[0], s2[0]) || s1[0] > s2[0]);
65 CMP(_CMP_ORD_S, !isunordered(s1[0], s2[0]));
66 CMP(_CMP_EQ_US, isunordered(s1[0], s2[0]) || s1[0] == s2[0]);
67 CMP(_CMP_NGE_UQ, isunordered(s1[0], s2[0]) || s1[0] < s2[0]);
68 CMP(_CMP_NGT_UQ, isunordered(s1[0], s2[0]) || s1[0] <= s2[0]);
69 CMP(_CMP_FALSE_OS, 0);
70 CMP(_CMP_NEQ_OS, !isunordered(s1[0], s2[0]) && s1[0] != s2[0]);
71 CMP(_CMP_GE_OQ, !isunordered(s1[0], s2[0]) && s1[0] >= s2[0]);
72 CMP(_CMP_GT_OQ, !isunordered(s1[0], s2[0]) && s1[0] > s2[0]);
73 CMP(_CMP_TRUE_US, 1);