| 1 |
/* { dg-do run { target i?86-*-* x86_64-*-* } } */ |
| 2 |
/* { dg-options "-O2 -msse2" } */ |
| 3 |
/* { dg-require-effective-target sse2_runtime } */ |
| 4 |
/* { dg-skip-if "requires hosted libstdc++ for cstdlib malloc" { ! hostedlib } } */ |
| 5 |
|
| 6 |
#include <xmmintrin.h> |
| 7 |
|
| 8 |
extern "C" void abort (); |
| 9 |
|
| 10 |
typedef double double_a __attribute__((__may_alias__)); |
| 11 |
|
| 12 |
struct V |
| 13 |
{ |
| 14 |
__m128d data; |
| 15 |
}; |
| 16 |
|
| 17 |
int |
| 18 |
main() |
| 19 |
{ |
| 20 |
V a; |
| 21 |
__m128d b; |
| 22 |
|
| 23 |
b = _mm_set_pd (1., 0.); |
| 24 |
a.data = _mm_set_pd (1., 0.); |
| 25 |
a.data = _mm_add_pd (a.data, |
| 26 |
_mm_and_pd (_mm_cmpeq_pd (a.data, _mm_set1_pd (0.)), |
| 27 |
_mm_set1_pd (2.))); |
| 28 |
reinterpret_cast<double_a *>(&a.data)[1] += 1.; |
| 29 |
b = _mm_add_pd (b, _mm_and_pd (_mm_cmpeq_pd (b, _mm_set1_pd (0.)), |
| 30 |
_mm_set1_pd (1.))); |
| 31 |
b = _mm_add_pd (b, _mm_and_pd (_mm_cmpeq_pd (b, _mm_set1_pd (1.)), |
| 32 |
_mm_set1_pd (1.))); |
| 33 |
if (_mm_movemask_pd (_mm_cmpeq_pd (a.data, b)) != 0x3) |
| 34 |
abort(); |
| 35 |
|
| 36 |
return 0; |
| 37 |
} |