2016-12-21 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / pr46880.c
blobbc6d642994c290a41b55f9ae535cbe9c7bc17c76
1 /* PR target/46880 */
2 /* { dg-do run } */
3 /* { dg-options "-O2 -fno-strict-aliasing -msse2" } */
4 /* { dg-require-effective-target sse2_runtime } */
6 typedef double __m128d __attribute__ ((__vector_size__ (16), __may_alias__));
7 typedef double (*T)[2];
9 static __attribute__ ((noinline, noclone)) __m128d
10 foo (__m128d c, __m128d d)
12 T cp = (T) &c;
13 T dp = (T) &d;
14 __m128d e = { (*cp)[1], (*dp)[1] };
15 return e;
18 int
19 main ()
21 __m128d c = { 1.0, 2.0 };
22 __m128d d = { 3.0, 4.0 };
23 union { __m128d x; double d[2]; } u;
24 u.x = foo (c, d);
25 if (u.d[0] != 2.0 || u.d[1] != 4.0)
26 __builtin_abort ();
27 return 0;