Day 5 of Advent of Compiler Optimisations!

x86 has LEA for multiplication tricks, but what does ARM bring to the party? Meet the barrel shifter—a hardware feature that lets many instructions shift their second operand. The compiler exploits this to turn multiplications into shifted adds, all in a single instruction. Different architectures, different superpowers!

Read more: xania.org/202512/05-barrel-shi
Watch: youtu.be/TZubUyr2UEY

0

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