'What is the rationale for setting all SSE/AVX registers call-clobbered in the SysV ABI?
The SysV ABI for x86_64 sets all XMM0~XMM15 registers call-clobbered. Whenever you call a function during operating on a lot of SSE registers, hopefully it gets inlined, or otherwise the compiler will save all SSE registers holding some useful value on the stack every time before a call. The only way to get around this is to use inline asm and set the clobbered registers manually if the compiler supports it, or just write straight in assembly.
Why was it designed this way? The MS ABI designates half of XMM registers call-preserved. For the integer registers, some are preserved and some are clobbered depending on the ABI. On a different architecture, ARM NEON has both callee-saved and caller-saved registers link.
With AVX512, there are 32 ZMM registers and the SysV ABI still considers all 32 of them call-clobbered. At this point I personally think this is a bad design, but there should have been a reason for it, so what was the rationale for such decision?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
