Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/struct_return.c

raw
1 /* Test the absence of a spurious move from x8 to x0 for functions
2 return structures. */
3 /* { dg-do compile } */
4 /* { dg-options "-O2" } */
5
6 struct s
7 {
8 long x;
9 long y;
10 long z;
11 };
12
13 struct s __attribute__((noinline))
14 foo (long a, long d, long c)
15 {
16 struct s b;
17 b.x = a;
18 b.y = d;
19 b.z = c;
20 return b;
21 }
22
23 int
24 main (void)
25 {
26 struct s x;
27 x = foo ( 10, 20, 30);
28 return x.x + x.y + x.z;
29 }
30
31 /* { dg-final { scan-assembler-not "mov\tx0, x8" } } */