Day 1 of Advent of Compiler Optimisations!
Uncategorized
1
Posts
1
Posters
0
Views
-
Day 1 of Advent of Compiler Optimisations!
Why do compilers love `xor eax, eax` for zeroing registers? It's brilliant: saves bytes compared to `mov eax, 0`, AND x86 CPUs recognise this "zeroing idiom" early in the pipeline—breaking register dependencies and removing it from execution entirely. Even better: writing to `eax` zeroes the top 32 bits of `rax` for free, handling 64-bit longs in one instruction.
Read more: https://xania.org/202512/01-xor-eax-eax
Watch: https://youtu.be/eLjZ48gqbyg -
undefined oblomov@sociale.network shared this topic