Author: Gerd Isenberg
Date: 11:11:24 04/08/04
Go up one level in this thread
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. 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 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.