Hi,

could someone explain to me/point me to some resources that explain branch prediction. What is it doing... or better how is it done in order to optimize code?

ThanX
PredeX
Posted on 2002-05-23 19:48:50 by PredeX
Posted on 2002-05-23 20:17:13 by bdjames
Agner Fog did an article for Dr Dobb's on branch prediction:

http://www.x86.org/articles/branch/branchprediction.htm

You should also read his optimization guide:

http://www.agner.org/assem/#optimize

:)
Posted on 2002-05-23 21:03:20 by S/390
Agner Fog's work is very good and is the best reference work around in this area as far as I know but there is a basic rule to avoid branch prediction problems, do whatever you need to do to reduce the number of branches in your speed critical algorithms.

You cannot entirely remove jumps in most code but where you can reduce the number of conditional jumps (Jxx), you often end up with a speed increase with your algorithm.

Regards,

hutch@movsd.com
Posted on 2002-05-23 21:28:52 by hutch--