* gcc.target/i386/pr70021.c: Add -mtune=skylake.
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx-vcmppd-256-1.c
blob1c169f5ac5cc2d78c9292a62d36fb639588ad68e
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 double s1[4]={2134.3343,6678.346,453.345635,54646.464356};
10 double s2[4]={41124.234,6678.346,8653.65635,856.43576};
11 long long e[4];
13 union
15 double d[4];
16 long long ll[4];
17 }d;
19 void check(unsigned imm, char *id)
21 if(checkVl(d.ll, e, 4)){
22 printf("mm256_cmp_pd(%s: 0x%x) FAILED\n", id, imm);
26 #define CMP(imm, rel) \
27 for (i = 0; i < 4; i++) e[i] = rel ? -1 : 0; \
28 source1 = _mm256_loadu_pd(s1); \
29 source2 = _mm256_loadu_pd(s2); \
30 dest = _mm256_cmp_pd(source1, source2, imm); \
31 _mm256_storeu_pd(d.d, dest); \
32 check(imm, "" #imm "");
34 static void
35 avx_test ()
37 __m256d source1, source2, dest;
38 int i;
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);