| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2 -fno-strict-aliasing -msse2" } */ |
| 3 |
/* { dg-additional-options "-mno-mmx" { target { ! ia32 } } } */ |
| 4 |
|
| 5 |
#include "sse2-check.h" |
| 6 |
#include "mmx-vals.h" |
| 7 |
|
| 8 |
__attribute__((noinline, noclone)) |
| 9 |
static void |
| 10 |
test_pcmpeqw (long long *ll1, long long *ll2, long long *r) |
| 11 |
{ |
| 12 |
__m64 t1 = *(__m64 *) ll1; |
| 13 |
__m64 t2 = *(__m64 *) ll2; |
| 14 |
*(__m64 *) r = _m_pcmpeqw (t1, t2); |
| 15 |
} |
| 16 |
|
| 17 |
/* Routine to manually compute the results */ |
| 18 |
static void |
| 19 |
compute_correct_result (long long *dst_p, long long *src_p, |
| 20 |
long long *res_p) |
| 21 |
{ |
| 22 |
short *dst = (short *) dst_p; |
| 23 |
short *src = (short *) src_p; |
| 24 |
short *res = (short *) res_p; |
| 25 |
int i; |
| 26 |
for (i = 0; i < 4; i++) |
| 27 |
res[i] = dst[i] == src[i] ? -1 : 0; |
| 28 |
} |
| 29 |
|
| 30 |
static void |
| 31 |
sse2_test (void) |
| 32 |
{ |
| 33 |
int i; |
| 34 |
long long r, ck; |
| 35 |
int fail = 0; |
| 36 |
|
| 37 |
/* Run the MMX tests */ |
| 38 |
for (i = 0; i < MMX_num_ops; i += 2) |
| 39 |
{ |
| 40 |
test_pcmpeqw (&MMXops[i], &MMXops[i + 1], &r); |
| 41 |
compute_correct_result (&MMXops[i], &MMXops[i + 1], &ck); |
| 42 |
if (ck != r) |
| 43 |
fail++; |
| 44 |
} |
| 45 |
|
| 46 |
if (fail != 0) |
| 47 |
abort (); |
| 48 |
} |