4 ms·
i += 7; Wouldn't this cause a sizable performance hit due to being misaligned most of the time?
by danbruc 9y ago
i += 7;
Wouldn't this cause a sizable performance hit due to being misaligned most of the time?
- secure 9y agoNo: many (most?) modern SIMD instructions don’t require alignment. From the Intel Intrinsics Guide (can’t figure out how to link directly to it, sorry) on _mm_loadu_si128: > Load 128-bits of integer data from memory into dst. mem_addr does not need to be aligned on any particular boundary.
- detaro 9y agoDoesn't need, but is there a performance difference? I seem to remember there is no difference between _mm_load_si128 and _mm_loadu_si128 on modern CPUs, but I'm not sure.
- deleted 9y ago[deleted]
- mattkrause 9y agoloadu is not the best example because its sole purpose is loading unaligned data. There is a separate load for aligned data.
- wmu 9y agoAuthor here. This was true several generations ago (core2, for instance), now the performance penalty is negligible.