I'm using the GCC compiler to load packed 16-bit data (i.e. two 16-bit words in a 32-bit value). My pointer is to a 32-bit type because I want to load two 16-bit values in a single cycle but the pointer is not necessarily aligned to a 4 byte boundary. GNU GCC generates LDRD to load two 32-bit values. This results in an alignment fault a run-time. Is there a compile option to prevent the compiler from using LDRD ? or an option to control alignment assumptions? Otherwise what's the best way to get the compiler to load packed data efficiently.
Hi Robert, Yes a modified version of the above works, thanks. I note that for GCC it appears that the packed attribute is only accepted when dealing with structures. I thought normally this refers to padding between the elements rather than packed in the SIMD sense.