在 2024-08-20 16:13, Frederick Virchanza Gotham via Gcc 写道:
I want to write a new calling convention into the GNU g++ compiler,
specifically for the x86_64 instruction set.

The x64 calling convention is much more complex than x86. Each of the first four parameter is not only assigned an integer register, but also an SSE register (XMM0 - XMM3) and a shadow slot on the stack. The four shadow slots (32 bytes) must always be reserved by any caller, and are free for use as temporary storage like red zones on ARM64 or on Linux.

So by assigning a parameter to RAX you have to sacrifice another register. I don't see a point in doing that.

Not to mention that MOV can be implemented by register renaming which has a 
latency of zero.

--
Best regards,
LIU Hao

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to