kit

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

callx_stackargs_long.c (617B)


      1 /* The 64-bit (long) analogue of callx_stackargs: 10 long arguments, so two
      2  * spill to the stack. Exercises 64-bit caller-side stack-arg stores (str x..)
      3  * and callee-side loads. `noinline` forces the real call. 1+2+...+10 = 55,
      4  * then -13 = 42. */
      5 __attribute__((noinline)) static long add10l(long a, long b, long c, long d,
      6                                              long e, long f, long g, long h,
      7                                              long i, long j) {
      8   return a + b + c + d + e + f + g + h + i + j;
      9 }
     10 int test_main(void) {
     11   long r = add10l(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
     12   return (int)(r - 13);
     13 }