3 ms·
> what's the point of using xmm registers when they'll get clobbered (or have to be moved back to memory) whenever you need to do a floating point operation? at
by phire 9y ago
> what's the point of using xmm registers when they'll get clobbered (or have to be moved back to memory) whenever you need to do a floating point operation? at least with ymm/zmm you can hope that you're not using AVX.
Nope, because SSE operations are explictly defined as setting the upper bits of the ymm/zmm registers to zero.
> as opposed to windows? regardless of whether it's the caller/callee's job to preserve registers, the result is the same.
There is a huge difference, with caller saved registers, the caller must compulsively save all registers it's using to the stack before it calls a function. With callee saved registers, if the callee doesn't use the registers, then it doesn't need to save them and a bunch of extra push/pops are saved.
It is optimal to have a mixture of caller and callee saved registers, so the compiler pick what type it uses for each function/variable.