aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/aarch64/asm-adder-no-clobber-lr.c
blob: 2543d50e78f776ea41efab259a45a56fcd767ef1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
extern void abort (void);

int
adder (int a, int b)
{
  int result;
  __asm__ ("add %w0,%w1,%w2" : "=r"(result) : "r"(a), "r"(b) : );
  return result;
}

int
main (int argc, char** argv)
{
  int i;
  int total = argc;
  for (i = 0; i < 20; i++)
    total = adder (total, i);

  if (total != (190 + argc))
    abort ();

  return 0;
}