Take:
void callee(void);
long call_and_ret_saved(long ToSave){
callee();
return ToSave;
}
where the generated assembly will need to save the value of the ToSave argument in order to be able to return it after the call to callee.
Both gcc and clang generate:
call_and_ret_saved:
pushq %rbx
movq %rdi, %rbx
call callee
movq %rbx, %rax
popq %rbx
ret
for it. Why not simply push %rdi; call callee; pop %rax; ret; ? Does using the call-preserved register make the return value available sooner or something?