agg_byval_big.c (575B)
1 /* A struct LARGER than 16 bytes (five ints, 20 bytes) passed by value. On the 2 * AArch64 PCS an aggregate > 16 bytes is passed indirectly: the caller copies 3 * it to a hidden stack slot and passes a pointer. Exercises the byval-by-memory 4 * lowering (caller-side memcpy/stores + pointer arg). sum of 2+4+6+8+22 = 42. 5 */ 6 struct Five { 7 int a, b, c, d, e; 8 }; 9 __attribute__((noinline)) static int sum5(struct Five s) { 10 return s.a + s.b + s.c + s.d + s.e; 11 } 12 int test_main(void) { 13 volatile int x = 2; 14 struct Five s = {x, x + 2, x + 4, x + 6, x + 20}; 15 return sum5(s); 16 }