When compiling the FLAC project with GCC, I get (almost) no compiler warnings. However, on compiling with clang, I get a lot of warnings like these
lpc_intrin_sse2.c:85:49: warning: cast from 'const FLAC__int32 *' (aka 'const int *') to 'const __m128i *' increases required alignment from 4 to 16 [-Wcast-align]
mull = _mm_madd_epi16(q9, _mm_loadu_si128((const __m128i*)(data+i-10))); summ = _mm_add_epi32(summ, mull);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
I don't really understand why. The instruction used here is specifically one to accept unaligned loads (hence the loadu), and gcc doesn't seem to mind. I know aligned loads are better/faster, but the code doesn't really permit that here, as each instruction accesses the data 4 bytes further. Getting this aligned would require copying the data 4 times with different alignments, which will probably cause cache problems.
Am I right in judging that there is indeed no problem? If there indeed is no problem, what is the best way to silence this warning? Is replacing (const __m128i*)
with (const __m128i*)(const void*)
acceptable here?