Consider this function in c: long arithEx(long, long, long, long, long, long, long, long);
long main()
{
long a,b,c,d,e,f,g,h,w;
a=100;
b=12345;
c=98765;
d=23;
e=25;
f=27;
g=29;
h=31;
w=arithEx(a,b,c,d,e,f,g,h);
w++;
return w;
}
In X-86, the assembly code looks like this:
main:
subq $24, %rsp
movq $31, 8(%rsp)
movq $29, (%rsp)
movq$27, %r9
movq$25, %r8
movq$23, %rcx
movq$98765, %rdx
movq$12345, %rsi
movq$100, %rdi
call arithEx
addq $1, %rax
addq $24, %rsp
ret
This makes sense to me since X-86 and Y-86 only have 6 registers to receive function arguments. And For X-86, since it supports immediate to memory addressing mode, we can just store the rest of the parameters to memory.
However, for Y-86, we don't have an instruction that can move an immediate to memory, so where should the rest of the parameters go?