kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

6_5_2_2_02_struct_param_2reg.c (414B)


      1 /* 16-byte struct passed by value — splits across two GPRs on all targets
      2  * (AAPCS64: x0,x1; SysV-x64: rdi,rsi; RV64: a0,a1). The DIRECT
      3  * classification carries two ABI parts; the backend loads each part from
      4  * the caller's source local at src_offset 0 and 8. */
      5 struct S {
      6   long a, b;
      7 };
      8 long take(struct S s) { return s.a + s.b; }
      9 int test_main(void) {
     10   struct S s = {20L, 22L};
     11   return (int)take(s);
     12 }