Hacker News new | ask | show | jobs
by michaelt 4575 days ago
Often when a CPU becomes "64 bit" it's not just the memory bus that's expanded, but all the CPU registers become wider, and often more are added. For example A32 had 14 32-bit registers, whereas A64 has 31 64-bit registers. This can speed up a variety of calculations.

For example adding 64-bit numbers; finding the end of zero-terminated strings; certain hashing and encryption operations; and so on.

It's also good marketing, of course.

1 comments

Yes, the importance of more (and to some extent larger) registers can't be understated. If you're not paying close attention, register spills (i.e. when the compiler doesn't have enough registers so decides to stick stuff on the stack) can easily turn decently performing code into poorly performing code if the register spill happens in a tight loop.

14 registers is pretty tight. 31 registers are better, and doubling the width helps for structure locals and parameters (which Clang/LLVM fortunately does a good job of keeping in registers). (I do a lot of work on a processor 60-odd 64-bit registers, and even then GCC decides to spill registers now and then.)