Daily bump.
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx-vcmpps-1.c
blob888f9eb2878d2fbd6c031445110313504793c2b1
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[4]={2134.3343,6678.346,453.345635,54646.464356};
10 float s2[4]={41124.234,6678.346,8653.65635,856.43576};
11 int e[4];
13 union
15 float f[4];
16 int i[4];
17 }d;
19 void check(unsigned imm, char *id)
21 if(checkVi(d.i, e, 4)){
22 printf("mm_cmp_ps(0x%x, %s) FAILED\n", imm, id);
26 static void
27 avx_test ()
29 __m128 source1, source2, dest;
30 int i;
32 #define CMP(imm, rel) \
33 for (i = 0; i < 4; i++) e[i] = rel ? -1 : 0; \
34 source1 = _mm_loadu_ps(s1); \
35 source2 = _mm_loadu_ps(s2); \
36 dest = _mm_cmp_ps(source1, source2, imm); \
37 _mm_storeu_ps(d.f, dest); \
38 check(imm, "" #imm "");
40 CMP(_CMP_EQ_OQ, !isunordered(s1[i], s2[i]) && s1[i] == s2[i]);
41 CMP(_CMP_LT_OS, !isunordered(s1[i], s2[i]) && s1[i] < s2[i]);
42 CMP(_CMP_LE_OS, !isunordered(s1[i], s2[i]) && s1[i] <= s2[i]);
43 CMP(_CMP_UNORD_Q, isunordered(s1[i], s2[i]));
44 CMP(_CMP_NEQ_UQ, isunordered(s1[i], s2[i]) || s1[i] != s2[i]);
45 CMP(_CMP_NLT_US, isunordered(s1[i], s2[i]) || s1[i] >= s2[i]);
46 CMP(_CMP_NLE_US, isunordered(s1[i], s2[i]) || s1[i] > s2[i]);
47 CMP(_CMP_ORD_Q, !isunordered(s1[i], s2[i]));
49 CMP(_CMP_EQ_UQ, isunordered(s1[i], s2[i]) || s1[i] == s2[i]);
50 CMP(_CMP_NGE_US, isunordered(s1[i], s2[i]) || s1[i] < s2[i]);
51 CMP(_CMP_NGT_US, isunordered(s1[i], s2[i]) || s1[i] <= s2[i]);
53 CMP(_CMP_FALSE_OQ, 0);
54 CMP(_CMP_NEQ_OQ, !isunordered(s1[i], s2[i]) && s1[i] != s2[i]);
55 CMP(_CMP_GE_OS, !isunordered(s1[i], s2[i]) && s1[i] >= s2[i]);
56 CMP(_CMP_GT_OS, !isunordered(s1[i], s2[i]) && s1[i] > s2[i]);
57 CMP(_CMP_TRUE_UQ, 1);
59 CMP(_CMP_EQ_OS, !isunordered(s1[i], s2[i]) && s1[i] == s2[i]);
60 CMP(_CMP_LT_OQ, !isunordered(s1[i], s2[i]) && s1[i] < s2[i]);
61 CMP(_CMP_LE_OQ, !isunordered(s1[i], s2[i]) && s1[i] <= s2[i]);
62 CMP(_CMP_UNORD_S, isunordered(s1[i], s2[i]));
63 CMP(_CMP_NEQ_US, isunordered(s1[i], s2[i]) || s1[i] != s2[i]);
64 CMP(_CMP_NLT_UQ, isunordered(s1[i], s2[i]) || s1[i] >= s2[i]);
65 CMP(_CMP_NLE_UQ, isunordered(s1[i], s2[i]) || s1[i] > s2[i]);
66 CMP(_CMP_ORD_S, !isunordered(s1[i], s2[i]));
67 CMP(_CMP_EQ_US, isunordered(s1[i], s2[i]) || s1[i] == s2[i]);
68 CMP(_CMP_NGE_UQ, isunordered(s1[i], s2[i]) || s1[i] < s2[i]);
69 CMP(_CMP_NGT_UQ, isunordered(s1[i], s2[i]) || s1[i] <= s2[i]);
70 CMP(_CMP_FALSE_OS, 0);
71 CMP(_CMP_NEQ_OS, !isunordered(s1[i], s2[i]) && s1[i] != s2[i]);
72 CMP(_CMP_GE_OQ, !isunordered(s1[i], s2[i]) && s1[i] >= s2[i]);
73 CMP(_CMP_GT_OQ, !isunordered(s1[i], s2[i]) && s1[i] > s2[i]);
74 CMP(_CMP_TRUE_US, 1);