Search code examples
windowsassemblyx86-64ssecalling-convention

Why doesn't the Windows x64 calling convention use XMM registers to pass more than 4 integer args?


The (Microsoft) x64 calling convention states:

The arguments are passed in registers RCX, RDX, R8, and R9. If the arguments are float/double, they are passed in XMM0L, XMM1L, XMM2L, and XMM3L.

That's great, but why just floats/doubles? Why aren't integers (and maybe pointers) also passed via XMM registers?
Seems a little like a waste of available space, doesn't it?


Solution

  • Because most operations on non-FP values (i.e. integers and addresses) are designed to use general purpose registers.

    There're integer SSE operations but they are arithmetical only.

    So, if calling convention supported passing integers and addresses via SSE registers, it would be almost always necessary to copy value to general purpose registers.