Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Avoiding if ( expr ) and branch misprediction ?

Author: Gerd Isenberg

Date: 12:19:22 01/19/06

Go up one level in this thread


>>>assert(expression == 0 || expression == 1);
>>>foo[expression]();
>>
>>No - avoid that for simple expressions!
>
>You might be surprised:
>http://chessprogramming.org/cccsearch/ccc.php?art_id=178068
>
>Depends on the compiler, of course.

Ok, a few years old - it was quite ok on P3 iirc.
To my knowledge on recent processors (amd64) indirect branches with (not
necessarily random) changed target addresses implies a missprediction.
Also i would never replace a simple array access by indrect branch.

 a = x[boolexpression];
 a = foo[boolexpression](); // returns either x[false] or x[true]






This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.