Here's an example source file:
Code:
int add(int x, int z) { int y = x + z; return y; }
If I compile that with "gcc -O -S source.c", I get the following assembly code on Arm:
Code:
add:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
add r0, r0, r1
bx lr
and on x86:
Code:
add:
.LFB0:
.cfi_startproc
movl 8(%esp), %eax
addl 4(%esp), %eax
ret
.cfi_endproc
.LFE0:
Apparently, gcc for Arm passes function arguments in registers r0 and r1 and returns the result in register r0. It can add those registers directly.
On x86, gcc passes function arguments on the stack and returns the result in %eax. The function has to load the first argument from the stack into register %eax, add the second argument from the stack to the same register, and return the result in that same register.
This is only one example. Different contexts (and different compilers/processors) will give different results.