| 1 |
/* PR target/21149 */ |
| 2 |
/* { dg-do run } */ |
| 3 |
/* { dg-options "-O2 -msse" } */ |
| 4 |
/* { dg-require-effective-target sse } */ |
| 5 |
|
| 6 |
#include "sse-check.h" |
| 7 |
|
| 8 |
#include <xmmintrin.h> |
| 9 |
|
| 10 |
void |
| 11 |
__attribute__((noinline)) |
| 12 |
check (__m128 x, float a, float b, float c, float d) |
| 13 |
{ |
| 14 |
union { __m128 m; float f[4]; } u; |
| 15 |
u.m = x; |
| 16 |
if (u.f[0] != a || u.f[1] != b || u.f[2] != c || u.f[3] != d) |
| 17 |
abort (); |
| 18 |
} |
| 19 |
|
| 20 |
static inline |
| 21 |
void |
| 22 |
foo (__m128 *x) |
| 23 |
{ |
| 24 |
__m128 y = _mm_setzero_ps (); |
| 25 |
__m128 v = _mm_movehl_ps (y, *x); |
| 26 |
__m128 w = _mm_movehl_ps (*x, y); |
| 27 |
check (*x, 9, 1, 2, -3); |
| 28 |
check (v, 2, -3, 0, 0); |
| 29 |
check (w, 0, 0, 2, -3); |
| 30 |
} |
| 31 |
|
| 32 |
static void |
| 33 |
sse_test (void) |
| 34 |
{ |
| 35 |
__m128 y = _mm_set_ps (-3, 2, 1, 9); |
| 36 |
foo (&y); |
| 37 |
} |