3 ms·
The thread seems to say nothing about them being faster. I guess if they were faster they would be quite useful for trampolines. Not sure you should ever use a
by revelation 10y ago
The thread seems to say nothing about them being faster. I guess if they were faster they would be quite useful for trampolines.
Not sure you should ever use a multi-byte instruction for alignment, but then you shouldn't use NOP for alignment in general. That's what 0xCC is for.
- gliptic 10y agoSince 0xCC is an interrupt, it's only useful for padding that isn't executed. If you want to align loops, you need NOPs. Single-instruction, multi-byte NOPs are certainly preferred by modern compilers.
- revelation 10y agoInteresting, I didn't know loop alignment was a thing. I guess it makes sense since code is just data, too.
- scaramanga 10y agoAbsolutely. Furthermore, if the loop is small enough it can execute from uop cache and the instruction fetcher/decoder can be powered down for a turbo boost.
- greglindahl 10y agoI was involved with a compiler pre-2006, and it's a fairly obvious observation that the Intel and AMD instruction decoding of the day was happier with multi-byte nops over multiple nops, for different reasons, but still faster for both.