Day 2 of Advent of Compiler Optimisations!

How do you add two integers on x86-64? You might expect `add`, but the compiler has other ideas—it uses an instruction designed for calculating memory addresses instead! Why would it choose this unusual approach, and what advantages does it bring? The answer reveals something fascinating about x86's quirky architecture.

Read more: xania.org/202512/02-adding-int
Watch: youtu.be/BOvg0sGJnes

0
0
0

If you have a fediverse account, you can quote this note from your own instance. Search https://hachyderm.io/users/mattgodbolt/statuses/115649740759978697 on your instance and quote it. (Note that quoting is not supported in Mastodon.)