|
|
|
|
|
by SkiFire13
1033 days ago
|
|
> C has always had a concept of implementation defined behavior, and unaligned memory accesses used to be defined to work correctly on x86. There are a bunch of misconceptions here: - unaligned loads were never implementation defined, they are undefined; - even if they were implementation defined, this would give the compiler the choice of how to define them, not the instruction set; - unaligned memory accesses on x86 for non-vector registers still work fine, so old instructions were not impacted and there's no bug. It's just that the expectations were not fulfilled for the new extension of those instructions. |
|
For example, on Pentium 3 and Pentium Core 2, the unaligned instructions took twice as many cycles to execute. On modern x86 family processors, it’s the same cycle count either way. The only perf penalty one should account for is crossing of cache lines, generally a much smaller problem.