1 |
691 |
jeremybenn |
/* { dg-do run } */
|
2 |
|
|
/* { dg-require-effective-target avx } */
|
3 |
|
|
/* { dg-require-effective-target c99_runtime } */
|
4 |
|
|
/* { dg-options "-O2 -mavx -std=c99" } */
|
5 |
|
|
|
6 |
|
|
#include "avx-check.h"
|
7 |
|
|
#include <math.h>
|
8 |
|
|
|
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];
|
12 |
|
|
|
13 |
|
|
union
|
14 |
|
|
{
|
15 |
|
|
double d[4];
|
16 |
|
|
long long ll[4];
|
17 |
|
|
}d;
|
18 |
|
|
|
19 |
|
|
void check(unsigned imm, char *id)
|
20 |
|
|
{
|
21 |
|
|
if(checkVl(d.ll, e, 4)){
|
22 |
|
|
printf("mm256_cmp_pd(%s: 0x%x) FAILED\n", id, imm);
|
23 |
|
|
}
|
24 |
|
|
}
|
25 |
|
|
|
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 "");
|
33 |
|
|
|
34 |
|
|
static void
|
35 |
|
|
avx_test ()
|
36 |
|
|
{
|
37 |
|
|
__m256d source1, source2, dest;
|
38 |
|
|
int i;
|
39 |
|
|
|
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]));
|
48 |
|
|
|
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]);
|
52 |
|
|
|
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);
|
58 |
|
|
|
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);
|
75 |
|
|
|
76 |
|
|
}
|