Computer Chess Club Archives


Search

Terms

Messages

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

Author: Dann Corbit

Date: 11:46:04 04/08/04

Go up one level in this thread


On April 08, 2004 at 14:33:39, Gerd Isenberg wrote:

>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];

Yes.  Also, you were concerned about the transition to move lists already.
But I also have the bitmaps returned, so I have that data too.

The bitmaps are based on all the pieces on the board and are the attacked
squares (including empty ones, ones with enemy pieces and ones with my pieces)
and also shadow bitmaps (which are squares attacked up to and including the next
piece on the ray behind the first attacked one -- if any).

>>
>>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)

I don't use any assembly at all.  I compile and link on all kinds of crazy
machines including Tru64 Alpha and IBM mainframe.  Assembly would just get in
the way.
>>
>>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.