Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Anything to this hyperbola bitboard URL?

Author: Larry Griffiths

Date: 11:56:24 09/27/00

Go up one level in this thread


On September 27, 2000 at 13:41:58, Vincent Diepeveen wrote:

>On September 27, 2000 at 08:57:05, Larry Griffiths wrote:
>
>>On September 27, 2000 at 00:56:03, Dann Corbit wrote:
>>
>>I cant understand exactly how his reverse stuff works.  I must be getting too
>>old to grasp some of this stuff.
>>
>>My program "DeepTrouble" can use Winboard now.  Do you hold tourny's and play
>>the programs against each other to get your rating list?  I would like to at
>>least get it into someone's hands to get some sort of rating.  I wrote my MMX
>>stuff in "C++" so that I can compile it to run on regular Pentium machines if
>>needed, but the "C++" code is about half as fast as the MMX code.
>>
>>Larry.
>
>Can you give examples of assembly that you put in the MMX registers
>and what you use it for with regard to chess engines?

MMX mainly reduces the amount of cpu I use compared to using C++ code.
The EMMS instruction is not show here but the "EMMS" instruction MUST be done
before doing any floating point instructions.

This code is written for the Borland Builder version 5 compiler.

I use defines so that I can have code generated inline...
This generates Captures and moves and puts the results in two
bitboards (bbCaptures and bbMoves)...


#define	defbbGenNonSlidingCapturesMoves(fsq,bbopieces,bbattacks)\
	{\
	_ESI = (unsigned long)fsq;\
	asm	movq	mm1,qword ptr[bbopieces];\
	asm	movq	mm0,qword ptr[bbRankOccupied];\
	asm	pand	mm1,qword ptr[bbattacks+ESI*8];\
	asm	pandn	mm0,qword ptr[bbattacks+ESI*8];\
	asm	movq	qword ptr[bbCaptures],mm1;\
	asm	movq	qword ptr[bbMoves],mm0;\
	}
//---------------------------------------------------------------------------
void	__fastcall TCWKnight::GenerateCapturesMoves()
	{
	//---------------------------------
	defbbGenNonSlidingCapturesMoves(MySquare,bbRankBlackPieces,bbMaskKnightAttacks);
	//---------------------------------
	}

This example generates two bitboards for the BISHOP's
captures and moves...

#define	defbbGenSplitBishopCapturesMoves(fsq,bbrankocpieces)\
	{\
	_ESI = (unsigned long)fsq;\
	asm	movq	mm6,bbLDiagOccupied;\
	asm	movq	mm7,bbRDiagOccupied;\
	asm	movd	mm2,[bbShiftLDiag+ESI*4];\
	asm	movd	mm3,[bbShiftRDiag+ESI*4];\
	asm	psrlq	mm6,mm2;\
	asm	psrlq	mm7,mm3;\
	asm	pand	mm6,bbMaskFF;\
	asm	pand	mm7,bbMaskFF;\
	asm	shl	ESI,0x0b;\
	asm	movd	EDX,mm6;\
	asm	movq	mm2,[bbLDiagAdjacentPieces+ESI+EDX*8];\
	asm	pand	mm2,[bbrankocpieces];\
	asm	movd	EDX,mm7;\
	asm	movq	mm3,[bbRDiagAdjacentPieces+ESI+EDX*8];\
	asm	pand	mm3,[bbrankocpieces];\
	asm	por	mm2,mm3;\
	asm	movq	bbCaptures,mm2;\
	asm	movd	EDX,mm6;\
	asm	movq	mm2,[bbLDiagAdjacentEmptySquares+ESI+EDX*8];\
	asm	movd	EDX,mm7;\
	asm	movq	mm3,[bbRDiagAdjacentEmptySquares+ESI+EDX*8];\
	asm	por	mm2,mm3;\
	asm	movq	bbMoves,mm2;\
	}
//---------------------------------------------------------------------------
void	__fastcall TCBBishop::GenerateCapturesMoves()
	{
	//---------------------------------
	defbbGenSplitBishopCapturesMoves(MySquare,bbRankWhitePieces);
	//---------------------------------
	}




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.