Author: Gerd Isenberg
Date: 13:38:38 11/20/05
Go up one level in this thread
On November 20, 2005 at 13:41:39, Dieter Buerssner wrote: >On November 18, 2005 at 14:38:28, Gerd Isenberg wrote: > >>12.3 Branch prediction in PMMX, PPro, P2, and P3 pg 43 >>.... >>Indirect jumps and calls (PMMX, PPro, P2 and P3) >>There is no pattern recognition for indirect jumps and calls, and the BTB can >>remember no more than one target for an indirect jump. It is simply predicted to >>go to the same target as it did last time. > >This might work out well in this case. As you are aware, chess engines do most >work close to the leafs. I don't know Fruit's source and the circumstances in >which the cited code snippet will be executed. I might well be the case, that in >90% of the cases, the switch will jump to the case of depth 0 and 1. Of course, >also "normal" branch prediction for if/else if/else should work excellent under >these circumstances. > >Regards, >Dieter I absolutly agree, Dieter. Nothings beats cmp-jcc here. Similar branches in (q)search like depth < 0 are probably more sensible to miss-predicted branches. Here some branchless substitution may pay off: fm = (depth < 0) ? fm1 : fm2; fm = fm2 + (depth < 0) * (fm1-fm2); fm = fm2 +((depth>>31) & (fm1-fm2)); Since shift on P4 is "dead"-slow, this is suited for athlon or amd64. How do you understand the indirect jmp works on amd64? I still found the qoute from amd optimization manual contradictory: "To avoid a comparison chain and its undesirable effects on branch prediction, replace the switch statement with a series of if-else statements..." Cheers, Gerd
This page took 0.01 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.