plugwash wrote:AIUI the main performance advantages of 64-bit mode are the ability to work with 64-bit integers in a single step rather than two (an obvious advantage for any code that works with 64-bit integers) and more and larger registers (if you start trying to work with 64-bit numbers on 32-bit arm the supply of registers starts looking pretty low).
The disadvantage is that any variables of type size_t, long or pointer just doubled in size.That means more memory consumption and potentially more data flowing on the memory bus.
The code size is smaller though.
64 bit mode gives:
1) A new redesigned, streamlined, instruction set in tune with modern hardware. Some nice things like ldm/stm are missing but I think they are very slow and had issues with interrupts (replaced with stp/ldp which can take any random pair of registers). Also most of the conditional execution is gone (because modern branch prediction doesn't need it and the encoding space can be better used elsewhere. There are some nice new instructions like csel etc instead and immediate's are larger and much easier to use now (mostly).
2) 31 64-bit registers instead of 15 32-bit registers. And register 31 (PC) is now a very handy "zero" register when read.
3) 128-bit floating point. In C, and I presume C++ long double was 64-bit, the same as double, in aarch64 it is 128-bit. This software implementation is apparently only feasible on 64-bit hardware.
4) more address space - mostly useless on a 1GB Pi (but I have seen statements that its needed for 2GB, a bit surprising I would have expected a 4GB limit for 32-bit, but it is why the other cortex-a53 SBC's provide 64-bit OS's).
5) NEON is mandatory. There are no co-processors any more. Furthermore armv8 NEON supports full IEEE754 floating point, but only in 64-bit mode.
6) Obviously faster execution of 64 bit integer arithmetic. But NEON has always been able to do this. Large file handling (_FILE_OFFSET_BITS 64) is presumably slightly faster.
7) there is no longer direct access to the PC, for example to return from a function the "ret" insn must be used.