assembly - What is faster: JMP or string of NOPs? -
i'm implementing binary translation , have deal sequences of nops (0x90) length 16 opcodes. better performance place jmp (to end) @ start of such sequences?
the intel architecture software developer's guide, volume 2b (instructions n-z) contains following table (pg 4-12) nop
:
table 4-9. recommended multi-byte sequence of nop instruction
length assembly byte sequence ================================================================================= 2 bytes 66 nop 66 90h 3 bytes nop dword ptr [eax] 0f 1f 00h 4 bytes nop dword ptr [eax + 00h] 0f 1f 40 00h 5 bytes nop dword ptr [eax + eax*1 + 00h] 0f 1f 44 00 00h 6 bytes 66 nop dword ptr [eax + eax*1 + 00h] 66 0f 1f 44 00 00h 7 bytes nop dword ptr [eax + 00000000h] 0f 1f 80 00 00 00 00h 8 bytes nop dword ptr [eax + eax*1 + 00000000h] 0f 1f 84 00 00 00 00 00h 9 bytes 66 nop dword ptr [eax + eax*1 + 00000000h] 66 0f 1f 84 00 00 00 00 00h
this allows construct "padding nop
" of sizes. 2 of those, can bridge 16 bytes, although second suggestion check optimization guides (for cpu you're targeting) whether jmp
faster 2 such nops
.
Comments
Post a Comment