summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/other/pr40446.C
blob: 72cd1960649e16289808601c4faab2df9687856e (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
38
// PR middle-end/40446
// { dg-do run { target i?86-*-* x86_64-*-* } }
// { dg-options "-O1 -msse2" }
// { dg-require-effective-target sse2_runtime }

#include <emmintrin.h>

extern "C" void abort ();

struct S
{
  S (double r, double i) { __real__ s = r; __imag__ s = i; }
  __complex__ double s;
};

__m128d
foo ()
{
  S c (0, 1);
  return _mm_load_pd ((double *) &c);
}

static void
__attribute__((noinline))
sse2_test ()
{
  union { __m128d vec; double val[2]; } u;
  u.vec = foo ();
  if (u.val[0] != 0 || u.val[1] != 1)
    abort ();
}

int
main ()
{
  sse2_test ();
  return 0;
}