aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.4.3/gcc/testsuite/gcc.target/i386/pr39139.c
blob: 95ea7fda9ba6ad1faa1156b40e097354d4205866 (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
39
/* PR target/39139 */
/* { dg-do compile } */
/* { dg-options "-Os" } */

#ifdef __x86_64__
# define AX_REG asm ("rax")
# define DI_REG asm ("rdi")
# define SI_REG asm ("rsi")
#else
# define AX_REG asm ("eax")
# define DI_REG asm ("edi")
# define SI_REG asm ("esi")
#endif

static inline int
foo (unsigned int x, void *y)
{
  register unsigned long r AX_REG;
  register unsigned long a1 DI_REG;
  register unsigned long a2 SI_REG;
  a1 = (unsigned long) x;
  a2 = (unsigned long) y;
  asm volatile ("" : "=r" (r), "+r" (a1), "+r" (a2) : : "memory");
  return (int) r;
}

struct T { unsigned long t1, t2; unsigned int t3, t4, t5; };

int
bar (unsigned long x, unsigned int y, unsigned long u, unsigned int v)
{
  long r;
  struct T e = { .t1 = x, .t2 = u };

  if (x << y != u << v)
    return 5;
  r = foo (11, &e);
  return e.t3 == x;
}