| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2 -msse2" } */ |
| 3 |
/* { dg-require-effective-target sse2 } */ |
| 4 |
#include "sse2-check.h" |
| 5 |
#include <xmmintrin.h> |
| 6 |
extern void abort(); |
| 7 |
int untrue = 0; |
| 8 |
typedef union { |
| 9 |
__v4sf v; |
| 10 |
float f[4]; |
| 11 |
} u; |
| 12 |
void foo (u, u) __attribute__((noinline)); |
| 13 |
void foo (u a, u b) { |
| 14 |
if (b.f[0] != 7.0 || b.f[1] != 8.0 || b.f[2] != 3.0 || b.f[3] != 4.0) |
| 15 |
abort(); |
| 16 |
} |
| 17 |
void bar (__v4sf, __v4sf) __attribute__((noinline)); |
| 18 |
void bar (__v4sf a __attribute((unused)), __v4sf b __attribute((unused))) { untrue = 0;} |
| 19 |
__v4sf setupa () __attribute((noinline)); |
| 20 |
__v4sf setupa () { __v4sf t = { 1.0, 2.0, 3.0, 4.0 }; return t; } |
| 21 |
__v4sf setupb () __attribute((noinline)); |
| 22 |
__v4sf setupb () { __v4sf t = { 5.0, 6.0, 7.0, 8.0 }; return t; } |
| 23 |
void __attribute__((noinline)) |
| 24 |
sse2_test(void) { |
| 25 |
u a, b; |
| 26 |
a.v = setupa (); |
| 27 |
b.v = setupb (); |
| 28 |
if (untrue) |
| 29 |
bar(a.v, b.v); |
| 30 |
b.v = (__v4sf) _mm_movehl_ps ((__m128)a.v, (__m128)b.v); |
| 31 |
foo (a, b); |
| 32 |
} |