aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/i386/pr51987.c
blob: 6ac2e6395d8b3fd99b7d31502323a05108564848 (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
/* PR tree-optimization/51987 */
/* { dg-do run { target { ! { ia32 } } } } */
/* { dg-options "-O3" } */

extern void abort (void);
union U { unsigned long long l; struct { unsigned int l, h; } i; };

__attribute__((noinline, noclone)) void
foo (char *x, char *y)
{
  int i;
  for (i = 0; i < 64; i++)
    {
      union U u;
      asm ("movl %1, %k0; salq $32, %0" : "=r" (u.l) : "r" (i));
      x[i] = u.i.h;
      union U v;
      asm ("movl %1, %k0; salq $32, %0" : "=r" (v.l) : "r" (i));
      y[i] = v.i.h;
    }
}

int
main ()
{
  char a[64], b[64];
  int i;
  foo (a, b);
  for (i = 0; i < 64; i++)
    if (a[i] != i || b[i] != i)
      abort ();
  return 0;
}