kit

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

6_5_2_2_01_struct_param_1reg.c (348B)


      1 /* 8-byte struct passed by value — fits in one GPR on all targets
      2  * (AAPCS64: x0; SysV-x64: rdi; RV64: a0). Exercises DIRECT classification
      3  * with a single ABI part loaded from the caller's source lvalue. */
      4 struct S {
      5   int a, b;
      6 };
      7 int take(struct S s) { return s.a + s.b; }
      8 int test_main(void) {
      9   struct S s = {20, 22};
     10   return take(s);
     11 }