X86 branch prediction question
Submitted by epr on Thu, 09/02/2004 - 08:21.
Hi all,
Does anyone know which of the following pieces of code is faster on Pentium & up processors? I'm not sure what the effect of static misprediction in the first piece is.
Code 1:
CMP [reg1],reg2 JA theend INT 5 theend:
Since "JA theend" is a conditional forward reference its static prediction is "not taken", but it will almost always be taken (in the case that most array indexes are valid)
Code 2:
JMP test fail: INT 5 test: CMP [reg1],reg2 JNA fail
- Login to post comments
I found this link, while tryi
I found this link, while trying to learn more about this topic.
http://www.x86.org/articles/branch/branchprediction.htm
thanks
Dev.