Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: A question about move generators for bishops and rooks

Author: Gerd Isenberg

Date: 11:33:39 04/08/04

Go up one level in this thread


On April 08, 2004 at 14:11:24, Gerd Isenberg wrote:

>On April 08, 2004 at 13:19:21, Dann Corbit wrote:
>
>
>>Anyway, you pretty much understand it now.
>
>That's fine.
>
>How many instructions to perform the state packing?
>
>mask        = (1 << bitIndex2remove) - 1; // bitIndex2remove 0..7
>state       =  eightBitState       &  mask;
>packed      = (eightBitState >> 1) & ~mask; // unsigned shift msb is zero
>packedState = packed|state;
>
>Six/seven instructions.

Ok, or one memory access ;-)

packedState = somePrecalc[eightBitState][bitIndex2remove];


>
>What about that one:
>Combination of rotated and reversed bitboards (4*2 == 8 occupied boards to
>update) and to use some bytewise simd instructions performing the xor minus two
>trick, with 128-bit registers simultaniously for white and black:
>
>// xmm3 occupied:occupied
>// xmm1 brooks:wrooks
>movq	xmm7, xmm3	; occupied

oups movdqa for xmm regsiters

movdqa	xmm7, xmm3	; occupied
psubb	xmm3, xmm1	; occupied -   rooks
psubb	xmm3, xmm1	; occupied - 2*rooks
pxor	xmm3, xmm7	; rightattacks := occupied ^ (occupied - 2*rooks)
>
>The crux are the reversed result bitboards of the four "negative" directions.
>Four parallel bit reversals keep the pipes busy but are too heavy ;-)



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.