Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: some quotes on switch and indirect branches

Author: Dieter Buerssner

Date: 16:07:16 11/22/05

Go up one level in this thread


On November 21, 2005 at 20:00:24, Eugene Nalimov wrote:

>On November 21, 2005 at 18:10:54, Dieter Buerssner wrote:
>
>>[...]
>>I guess, you mean this as a substitution for
>>  if (depth < 0)
>>    fm = fm1;
>>  else
>>    fm = fm2;
>>
>>I am surprised, that compilers are not able to do this themselves. I
>
>I several times tried to modify Visual C to recognize additional cases where we
>should emit conditional moves (last time was probably a year ago for
>x64-targeting compiler). Every time I could demonstrate win on a small
>artificial test case, but every large real world program either showed no gain
>or slowed down.
>
>I suspect there are several reasons for this:
>* branch predictors are good, and majority of branches can be correctly
>predicted
>* CMOV is long instruction; short branch is shorter, so program with less CMOVs
>fits better into cache
>* there is no 8-bit form of CMOV
>* >* for invalid address "CMOV reg, memory" will give you access violation even if
>condition is false.

I don't really understand the last reason.

It might be possible, to detect (guess) cases, that are the real inner loops.
That should practically get rid of "CMOV is long instruction; short branch is
shorter, so program with less CMOVs fits better into cache".

About "there is no 8-bit form of CMOV". If that really hurts, it should be
rather easy, to only use them in the other cases?

Thanks for your interesting input,
Dieter



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.