27 Nov
2019
27 Nov
'19
12:36 p.m.
Hi Daniel, You seem to be right that the compilers are already mostly doing the right thing. Here is a notable exception where GCC lags behind clang (unnecessary use of stack): https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89804 I created another test program, checking how mach_read_from_4() gets compiled. It turns out that on Aarch64 and POWER, unaligned reads are being used by default: https://godbolt.org/z/ZcavM4 For 32-bit ARM, -march=armv6 seems to enable unaligned reads. For RISC-V and WebAssembly, the code is rather ugly. :-) So, indeed, there does not appear to be much to micro-optimize here. Marko -- Marko Mäkelä, Lead Developer InnoDB MariaDB Corporation