Are there any performance disadvantages of using .if and .elseif in assembly?
I was wondering if t开发者_Python百科he .if
and the .elseif
directives had any performance disadvantages when compared to using a series of cmp
and jmp
statements.
Thanks!
Devjeet
In general, there is no performance disadvantage.
However, if you decide to use them all the time, you should probably check the assembler generated every once in a while to better understand what they are doing to your code. There may be rare instances the produced code is slightly less efficient.
You are more probable to write a worse .if yourself actually. For instance, ".IF eax==0" is evaluated as :
test eax,eax
jnz label
it can't get better than this.
精彩评论