1 |
318 |
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[2]={2134.3343,6678.346};
|
10 |
|
|
double s2[2]={41124.234,6678.346};
|
11 |
|
|
long long e[2];
|
12 |
|
|
|
13 |
|
|
union
|
14 |
|
|
{
|
15 |
|
|
double d[2];
|
16 |
|
|
long long ll[2];
|
17 |
|
|
}d;
|
18 |
|
|
|
19 |
|
|
void check(unsigned imm, char *id)
|
20 |
|
|
{
|
21 |
|
|
if(checkVl(d.ll, e, 2)){
|
22 |
|
|
printf("mm_cmp_pd(%s: 0x%x) FAILED\n", id, imm);
|
23 |
|
|
}
|
24 |
|
|
}
|
25 |
|
|
|
26 |
|
|
#define CMP(imm, rel) \
|
27 |
|
|
for (i = 0; i < 2; i++) e[i] = rel ? -1 : 0; \
|
28 |
|
|
source1 = _mm_loadu_pd(s1); \
|
29 |
|
|
source2 = _mm_loadu_pd(s2); \
|
30 |
|
|
dest = _mm_cmp_pd(source1, source2, imm); \
|
31 |
|
|
_mm_storeu_pd(d.d, dest); \
|
32 |
|
|
check(imm, "" #imm "");
|
33 |
|
|
|
34 |
|
|
static void
|
35 |
|
|
avx_test ()
|
36 |
|
|
{
|
37 |
|
|
__m128d source1, source2, dest;
|
38 |
|
|
int i;
|
39 |
|
|
|
40 |
|
|
d.ll[0] = e[0] = 222;
|
41 |
|
|
d.ll[1] = e[1] = -33;
|
42 |
|
|
|
43 |
|
|
CMP(_CMP_EQ_OQ, !isunordered(s1[i], s2[i]) && s1[i] == s2[i]);
|
44 |
|
|
CMP(_CMP_LT_OS, !isunordered(s1[i], s2[i]) && s1[i] < s2[i]);
|
45 |
|
|
CMP(_CMP_LE_OS, !isunordered(s1[i], s2[i]) && s1[i] <= s2[i]);
|
46 |
|
|
CMP(_CMP_UNORD_Q, isunordered(s1[i], s2[i]));
|
47 |
|
|
CMP(_CMP_NEQ_UQ, isunordered(s1[i], s2[i]) || s1[i] != s2[i]);
|
48 |
|
|
CMP(_CMP_NLT_US, isunordered(s1[i], s2[i]) || s1[i] >= s2[i]);
|
49 |
|
|
CMP(_CMP_NLE_US, isunordered(s1[i], s2[i]) || s1[i] > s2[i]);
|
50 |
|
|
CMP(_CMP_ORD_Q, !isunordered(s1[i], s2[i]));
|
51 |
|
|
|
52 |
|
|
CMP(_CMP_EQ_UQ, isunordered(s1[i], s2[i]) || s1[i] == s2[i]);
|
53 |
|
|
CMP(_CMP_NGE_US, isunordered(s1[i], s2[i]) || s1[i] < s2[i]);
|
54 |
|
|
CMP(_CMP_NGT_US, isunordered(s1[i], s2[i]) || s1[i] <= s2[i]);
|
55 |
|
|
|
56 |
|
|
CMP(_CMP_FALSE_OQ, 0);
|
57 |
|
|
CMP(_CMP_NEQ_OQ, !isunordered(s1[i], s2[i]) && s1[i] != s2[i]);
|
58 |
|
|
CMP(_CMP_GE_OS, !isunordered(s1[i], s2[i]) && s1[i] >= s2[i]);
|
59 |
|
|
CMP(_CMP_GT_OS, !isunordered(s1[i], s2[i]) && s1[i] > s2[i]);
|
60 |
|
|
CMP(_CMP_TRUE_UQ, 1);
|
61 |
|
|
|
62 |
|
|
CMP(_CMP_EQ_OS, !isunordered(s1[i], s2[i]) && s1[i] == s2[i]);
|
63 |
|
|
CMP(_CMP_LT_OQ, !isunordered(s1[i], s2[i]) && s1[i] < s2[i]);
|
64 |
|
|
CMP(_CMP_LE_OQ, !isunordered(s1[i], s2[i]) && s1[i] <= s2[i]);
|
65 |
|
|
CMP(_CMP_UNORD_S, isunordered(s1[i], s2[i]));
|
66 |
|
|
CMP(_CMP_NEQ_US, isunordered(s1[i], s2[i]) || s1[i] != s2[i]);
|
67 |
|
|
CMP(_CMP_NLT_UQ, isunordered(s1[i], s2[i]) || s1[i] >= s2[i]);
|
68 |
|
|
CMP(_CMP_NLE_UQ, isunordered(s1[i], s2[i]) || s1[i] > s2[i]);
|
69 |
|
|
CMP(_CMP_ORD_S, !isunordered(s1[i], s2[i]));
|
70 |
|
|
CMP(_CMP_EQ_US, isunordered(s1[i], s2[i]) || s1[i] == s2[i]);
|
71 |
|
|
CMP(_CMP_NGE_UQ, isunordered(s1[i], s2[i]) || s1[i] < s2[i]);
|
72 |
|
|
CMP(_CMP_NGT_UQ, isunordered(s1[i], s2[i]) || s1[i] <= s2[i]);
|
73 |
|
|
CMP(_CMP_FALSE_OS, 0);
|
74 |
|
|
CMP(_CMP_NEQ_OS, !isunordered(s1[i], s2[i]) && s1[i] != s2[i]);
|
75 |
|
|
CMP(_CMP_GE_OQ, !isunordered(s1[i], s2[i]) && s1[i] >= s2[i]);
|
76 |
|
|
CMP(_CMP_GT_OQ, !isunordered(s1[i], s2[i]) && s1[i] > s2[i]);
|
77 |
|
|
CMP(_CMP_TRUE_US, 1);
|
78 |
|
|
|
79 |
|
|
}
|