summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/sse-3.c
blob: 1be1d1aa223da0ca662f8b47a8bf08c47f3f1311 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* PR target/21149 */
/* { dg-do run } */
/* { dg-options "-O2 -msse" } */
/* { dg-require-effective-target sse } */

#include "sse-check.h"

#include <xmmintrin.h>

void
__attribute__((noinline))
check (__m128 x, float a, float b, float c, float d)
{
  union { __m128 m; float f[4]; } u;
  u.m = x;
  if (u.f[0] != a || u.f[1] != b || u.f[2] != c || u.f[3] != d)
    abort ();
}

static inline
void
foo (__m128 *x)
{
  __m128 y = _mm_setzero_ps ();
  __m128 v = _mm_movehl_ps (y, *x);
  __m128 w = _mm_movehl_ps (*x, y);
  check (*x, 9, 1, 2, -3);
  check (v, 2, -3, 0, 0);
  check (w, 0, 0, 2, -3);
}

static void
sse_test (void)
{
  __m128 y = _mm_set_ps (-3, 2, 1, 9);
  foo (&y);
}