Author: Larry Griffiths
Date: 06:29:06 01/25/01
Go up one level in this thread
On January 25, 2001 at 02:39:12, Landon Rabern wrote:
>What if you get a cutoff and do not need the moves. I only gen caps then only
>gen moves after I have tried all the caps, so that if I get a cutoff, the work
>of generating moves is saved.
It only cost me a few instructions to gen and save the Move bitboard. If a
cutoff does not occur, then the move generation amounts to extracting the bits
from the move bitboard.
>
>I also use the MMX registers for check detection which seems to speed that up a
>little.
>
Same here, My king in check detection...
#define defbbPiecesAttackingAWhiteKing(fsq)\
{\
asm lea EDI,bbPieces;\
_ESI = (unsigned long)fsq;\
asm movq mm0,qword ptr[EDI+bbRankBlackKnights*8];\
asm movq mm1,qword ptr[EDI+bbRankBlackKings*8];\
asm movq mm2,qword ptr[EDI+bbRankBlackPawns*8];\
asm pand mm0,qword ptr[bbMaskKnightAttacks+ESI*8];\
asm pand mm1,qword ptr[bbMaskKingAttacks+ESI*8];\
asm pand mm2,qword ptr[bbMaskWPawnAttacks+ESI*8];\
asm por mm0,mm1;\
asm lea EDI,bbArray1;\
asm por mm0,mm2;\
;\
asm movzx EAX,bbRankContentsOffset[ESI];\
asm movzx EBX,bbFileContentsOffset[ESI];\
asm movzx ECX,bbLDiagContentsOffset[ESI];\
asm movzx EDX,bbRDiagContentsOffset[ESI];\
asm movzx EAX,byte ptr [EDI+EAX+bbRankOccupied*8];\
asm movzx EBX,byte ptr [EDI+EBX+bbFileOccupied*8];\
asm movzx ECX,byte ptr [EDI+ECX+bbLDiagOccupied*8];\
asm movzx EDX,byte ptr [EDI+EDX+bbRDiagOccupied*8];\
;\
asm shl ESI,0x0b;\
asm lea EDI,bbPieces;\
asm movq mm1,[bbRankAdjacentEmptySquaresPieces+ESI+EAX*8];\
asm por mm1,[bbFileAdjacentEmptySquaresPieces+ESI+EBX*8];\
asm movq mm3,[bbLDiagAdjacentEmptySquaresPieces+ESI+ECX*8];\
asm por mm3,[bbRDiagAdjacentEmptySquaresPieces+ESI+EDX*8];\
asm pand mm1,[EDI+bbRankBlackRooksQueens*8];\
asm pand mm3,[EDI+bbRankBlackBishopsQueens*8];\
asm por mm0,mm1;\
asm por mm0,mm3;\
asm movq bbAttackedByPieces,mm0;\
}
>Have you tried coding the whole gereation routine in assembler. Like the loop
>to take moves out of the bitboard, etc. if so, any improvement?
>
I have not coded everything in assembler. Here is an example of updateing the
bitboards for a Pawn, Knight, or King.
A Rook updates its bitboard plus the RooksQueens bitboard. A Queen updats its
own bitboard plus RooksQueens and BishopsQueens. All pieces update 4 occupied
bitboards. One of the things that I do not like about the MMX instructions is
that I cannot perform an operation against memory other that a MOVQ.
#define defbbMove1(fsq,tsq,color,bb1)\
{\
asm mov ESI,fsq;\
asm mov EDI,tsq;\
asm lea EAX,bbArray1;\
;\
asm movq mm0,qword ptr[bbRankBitOn+ESI*8];\
asm lea EBX,bbPieces;\
asm movq mm1,qword ptr[bbFileBitOn+ESI*8];\
asm movq mm4,mm0;\
asm movq mm2,qword ptr[bbLDiagBitOn+ESI*8];\
asm movq mm5,mm0;\
asm movq mm3,qword ptr[bbRDiagBitOn+ESI*8];\
asm pandn mm0,qword ptr[EAX+bbRankOccupied*8];\
asm pandn mm1,qword ptr[EAX+bbFileOccupied*8];\
asm pandn mm2,qword ptr[EAX+bbLDiagOccupied*8];\
asm pandn mm3,qword ptr[EAX+bbRDiagOccupied*8];\
asm pandn mm4,qword ptr[EAX+bbRank##color##Pieces*8];\
asm pandn mm5,qword ptr[EBX+bbRank##color##bb1*8];\
asm por mm0,qword ptr[bbRankBitOn+EDI*8];\
asm por mm1,qword ptr[bbFileBitOn+EDI*8];\
asm por mm2,qword ptr[bbLDiagBitOn+EDI*8];\
asm por mm3,qword ptr[bbRDiagBitOn+EDI*8];\
asm por mm4,qword ptr[bbRankBitOn+EDI*8];\
asm por mm5,qword ptr[bbRankBitOn+EDI*8];\
asm movq qword ptr[EAX+bbRankOccupied*8],mm0;\
asm movq qword ptr[EAX+bbFileOccupied*8],mm1;\
asm movq qword ptr[EAX+bbLDiagOccupied*8],mm2;\
asm movq qword ptr[EAX+bbRDiagOccupied*8],mm3;\
asm movq qword ptr[EAX+bbRank##color##Pieces*8],mm4;\
asm movq qword ptr[EBX+bbRank##color##bb1*8],mm5;\
;\
}
>
>Regards,
>
>Landon
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.