Answer by Peter Cordes for Test whether a register is zero with CMP reg,0 vs...
Yes, there is a difference in performance.The best choice for comparing a register with zero is test reg, reg. It sets FLAGS the same way cmp reg,0 would, and is at least as fast1 as any other way,...
View ArticleAnswer by Brendan for Test whether a register is zero with CMP reg,0 vs OR...
It depends on the exact code sequence, which specific CPU it is, and other factors.The main problem with or al, al, is that it "modifies"EAX, which means that a subsequent instruction that uses EAX in...
View ArticleTest whether a register is zero with CMP reg,0 vs OR reg,reg?
Is there any execution speed difference using the following code:cmp al, 0je doneand the following:or al, aljz doneI know that the JE and JZ instructions are the same, and also that using OR gives a...
View Article