aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/i386/pr46880.c
blob: bc6d642994c290a41b55f9ae535cbe9c7bc17c76 (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
/* PR target/46880 */
/* { dg-do run } */
/* { dg-options "-O2 -fno-strict-aliasing -msse2" } */
/* { dg-require-effective-target sse2_runtime } */

typedef double __m128d __attribute__ ((__vector_size__ (16), __may_alias__));
typedef double (*T)[2];

static __attribute__ ((noinline, noclone)) __m128d
foo (__m128d c, __m128d d)
{
  T cp = (T) &c;
  T dp = (T) &d;
  __m128d e = { (*cp)[1], (*dp)[1] };
  return e;
}

int
main ()
{
  __m128d c = { 1.0, 2.0 };
  __m128d d = { 3.0, 4.0 };
  union { __m128d x; double d[2]; } u;
  u.x = foo (c, d);
  if (u.d[0] != 2.0 || u.d[1] != 4.0)
    __builtin_abort ();
  return 0;
}