3 ms·
movq %rdi, -24(%rsp) movq -24(%rsp), %rax It's amazing that this pattern isn't caught by peephole optimization. Assuming we want %rdi to end up
by kazinator 6y ago
movq %rdi, -24(%rsp)
movq -24(%rsp), %rax
It's amazing that this pattern isn't caught by peephole optimization.
Assuming we want %rdi to end up in both destinations, memory and %rax, that wants to be:
movq %rdi, -24(%rsp)
movq %rdi, %rax
Is it true that we do not want it in both destinations? It's as if the code is trying to be compatible with two conventions for returning small structs, which could be a legitimate requirement. A library function catering to two conventions at the same time will be compatible with client code compiled with either one without itself having to be recompiled.