aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/i386-asm-1.c
blob: a23e0a0929828e0f0b91d16819efd93f8c1bd1ca (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
/* PR inline-asm/11676 */
/* { dg-do run { target i?86-*-* } } */
/* { dg-skip-if "" { i?86-*-* } { "-m64" } { "" } } */
/* { dg-options "-O2" } */

extern void abort (void);
static int bar(int x) __asm__("bar") __attribute__((regparm(1)));
static int __attribute__((regparm(1), noinline, used))
bar(int x)
{
  if (x != 0)
    abort ();
}

static int __attribute__((regparm(1), noinline))
foo(int x)
{
  x = 0;
  __asm__ __volatile__("call bar" : "=a"(x) : "a"(x));
}

int main()
{
  foo(1);
  return 0;
}