I'm taking an x86 assembly language programming class and know that certain instructions shouldn't be used anymore -- because they're slow on modern processors; for example, the loop instruction.
I haven't been able to find any list of instructions that are considered deprecated and should be avoided; any guidance would be appreciated.
If you what to know what to avoid, go directly to the processor manufacturers, both intel and amd have manuals for the instruction sets their processors support and to what degree they support them, your best bet if probably the optimization volumes, but if your only just starting out, take Jim's advice, get the thing working first before you worry about speed
Oh, but there still might be a good reason to use the
loop
instruction. For example,loop label
only requires two bytes. As opposed todec cx
followed byjnz label
requires three bytes. Sometimes code size is more important than speed.I would suggest, however, that if you're just learning x86 assembly--especially if this is your first foray into assembly language--that you first concentrate on how to do things. Once you've gotten a better feel for how things work, then worry about making them faster.
Your best bet is to consult Intel's official optimization guide.
This an other manuals can be found here.
All CPU instructions are 100% functional to reach compatibility with older CPUs. So why to avoid some instruction? There is no realy deprecated x86 instructions! But we can say:
1)All string istructions like rep movsb are slower.
2) xlat is slow and very rare in use.
3)Also the use of stack frame functions ENTER and LEAVE is slow.
4)Uder Windows (XP, vista...) the deprecated instructions are IN and OUT, but only under CPU ring 2 (aplication level), also the int nn is deprecated, except int3 (debugger trap).
EDIT: added simple speed test to check strings instruction
rep cmp
on different versions of CPUs.Test is made under Delphi IDE but the asm part is very easy to translate in any other IDE.
TESTs for ArraySize = 50000
Average results...
1)My Intel single core CPU Pentium 4 results: Loop ticks : 232000; Rep ticks : 233000
2)My Intel Core 2 Quad CPU results: Loop ticks : 158000; Rep ticks : 375000