summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/aarch64/asm-adder-clobber-lr.c
blob: 540c79b0135272b096e799e8bc60e4cbc124955d (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) : "x30");
  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;
}