Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: BSF/R not working well for me...

Author: Eugene Nalimov

Date: 11:08:25 04/26/01

Go up one level in this thread


On April 26, 2001 at 10:43:45, Miguel A. Ballicora wrote:

>On April 26, 2001 at 09:48:15, Vincent Diepeveen wrote:
>
>>On April 25, 2001 at 14:36:55, Bas Hamstra wrote:
>>
>>>On April 24, 2001 at 21:14:32, Landon Rabern wrote:
>>>
>>>>On April 24, 2001 at 08:44:15, Vincent Diepeveen wrote:
>>>>
>>>>>On April 23, 2001 at 22:19:33, Landon Rabern wrote:
>>>>>
>>>>>>On April 23, 2001 at 19:30:20, Alex Boby wrote:
>>
>>>>You are probably right, but I can see no way to get the same functionality
>>>>without branching.
>>>
>>>Yes, you can save 1 branch totally for free. I post mine again.
>>>
>>>int LastOne(BB M)
>>>{   __asm
>>>    {   mov EAX, dword ptr [M]
>>>        bsf EAX, EAX
>>>        jnz Done
>>>	mov EAX, dword ptr [M+4]
>>>        bsf EAX, EAX
>>>        add EAX, 32
>>>        Done:
>>>    }
>>>}
>>>
>>>Bas.
>>
>>So something which costs me without bitboards 0 clocks here
>>costs if branch misprediction at least 10 clocks at P3 and at least 20
>>at P4 and way more as 10 at K7.
>>
>>How about rewriting the above code to something larger *without*
>>branch?
>
>I suggested in this thread one way to do it that might not have any jumps.
>It is necessary to rewrite the loop.
>
>Regards,
>Miguel

Actually, at some moment Crafty included version without branches. It happened
that when those functions were inlined, version with branches was better (theory
is that inlined code worked for the similar positions, thus it usually had the
same argument passed, so it was possible to correctly predict the branch).

Eugene



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.