aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/aarch64/struct_return.c
blob: 6d90b7e59537ea66ad89e3615a2b11f2838b8779 (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
/* Test the absence of a spurious move from x8 to x0 for functions
   return structures.  */
/* { dg-do compile } */
/* { dg-options "-O2" } */

struct s
{
  long x;
  long y;
  long z;
};

struct s __attribute__((noinline))
foo (long a, long d, long c)
{
  struct s b;
  b.x = a;
  b.y = d;
  b.z = c;
  return b;
}

int
main (void)
{
  struct s x;
  x = foo ( 10, 20, 30);
  return x.x + x.y + x.z;
}

/* { dg-final { scan-assembler-not "mov\tx0, x8" } } */