Debian Codegraph @

gcc/testsuite/g++.dg/other/pr40446.C

raw
1 // PR middle-end/40446
2 // { dg-do run { target i?86-*-* x86_64-*-* } }
3 // { dg-options "-O1 -msse2" }
4 // { dg-require-effective-target sse2_runtime }
5 /* { dg-skip-if "requires hosted libstdc++ for cstdlib malloc" { ! hostedlib } } */
6
7 #include <emmintrin.h>
8
9 extern "C" void abort ();
10
11 struct S
12 {
13 S (double r, double i) { __real__ s = r; __imag__ s = i; }
14 __complex__ double s;
15 };
16
17 __m128d
18 foo ()
19 {
20 S c (0, 1);
21 return _mm_load_pd ((double *) &c);
22 }
23
24 static void
25 __attribute__((noinline))
26 sse2_test ()
27 {
28 union { __m128d vec; double val[2]; } u;
29 u.vec = foo ();
30 if (u.val[0] != 0 || u.val[1] != 1)
31 abort ();
32 }
33
34 int
35 main ()
36 {
37 sse2_test ();
38 return 0;
39 }