Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: R. Hyatt, Crafty style move generation

Author: Landon Rabern

Date: 20:08:47 01/24/01

Go up one level in this thread


On January 24, 2001 at 22:49:08, Landon Rabern wrote:

>On January 24, 2001 at 03:43:03, Severi Salminen wrote:
>
>>>How much of a speed increase did you get from using MMX?  I got only about a 35%
>>>increase.
>>
>>"Only"??? Are you mad :) 35% speedup from using different set of instructions is
>>_a lot_!! Are you now fast or were you slow back then?
>>
>>Severi
>
>I said only because I was under the impression that Larry was getting a lot
>faster, but I guess not.
>
>I was always pretty fast and now faster.  Around 400,000 nps on a PIII-500 with
>my whole search and eval and everything on.  My eval is not that complicated
>right now and could use some work and my move ordering can be improved some.  I
>am at school now and do not have much time except to work on a Neural Network
>for my eval which I convinced them to give me credit for.
>
>The version of my program that is released 5.1 I think does not have the MMX
>stuff because I did not want to deal with making it compatible for above and
>below PII.
>
>Regards,
>
>Landon

If anyone cares, here is the MMX code I wrote for it.  I would not doubt it if
tehre were some good ways to optimize it.

Regards,

Landon

#define gKnightMoves(fs)      \
{																						\
	__asm mov eax,fs\
	__asm shl eax,3\
	__asm movq mm0,[knightMoves+eax]    \
	__asm pand mm0,notAllPieces											  	\
        __asm movq toMap,mm0                                \
}

#define gWhiteKnightCaps(fs)      \
{																						\
	__asm mov eax,fs\
	__asm shl eax,3\
	__asm movq mm0,[knightMoves+eax]    \
	__asm pand mm0,blackPieces											  	\
        __asm movq toMap,mm0                                \
}

#define gBlackKnightCaps(fs)      \
{																						\
	__asm mov eax,fs\
	__asm shl eax,3\
	__asm movq mm0,[knightMoves+eax]   \
	__asm pand mm0,whitePieces											  	\
        __asm movq toMap,mm0                                \
}
#define gKingMoves(fs)      \
{																						\
	__asm mov eax,fs\
	__asm shl eax,3\
	__asm movq mm0,[kingMoves+eax]    \
        __asm pand mm0,notAllPieces											  	\
        __asm movq toMap,mm0                                \
}
#define gWhiteKingCaps(fs)      \
{																						\
	__asm mov eax,fs\
	__asm shl eax,3\
	__asm movq mm0,[kingMoves+eax]    \
        __asm pand mm0,blackPieces											  	\
        __asm movq toMap,mm0                                \
}
#define gBlackKingCaps(fs)      \
{																						\
	__asm mov eax,fs\
	__asm shl eax,3\
	__asm movq mm0,[kingMoves+eax]    \
        __asm pand mm0,whitePieces											  	\
        __asm movq toMap,mm0                                \
}
#define gWhitePawnMoves      \
{																						\
	__asm mov eax,board\
	__asm movq mm0,[eax].whitePawns    \
	__asm psllq mm0,8\
        __asm pand mm0,notAllPieces							 				  	\
        __asm movq toMap,mm0                                \
}
#define gBlackPawnMoves     \
{																						\
	__asm mov eax,board\
	__asm movq mm0,[eax].blackPawns    \
	__asm psrlq mm0,8\
        __asm pand mm0,notAllPieces							 				  	\
        __asm movq toMap,mm0                                \
}
#define gWhitePawnCapsLeft      \
{																						\
	__asm mov eax,board\
	__asm movq mm0,[eax].whitePawns    \
	__asm pand mm0,zeroLeft\
	__asm psllq mm0,9\
        __asm pand mm0,blackPieces											  	\
        __asm movq toMap,mm0                                \
}
#define gBlackPawnCapsRight     \
{																						\
	__asm mov eax,board\
	__asm movq mm0,[eax].blackPawns    \
	__asm pand mm0,zeroLeft\
	__asm psrlq mm0,7\
        __asm pand mm0,whitePieces											  	\
        __asm movq toMap,mm0                                \
}
#define gWhitePawnCapsRight      \
{																						\
	__asm mov eax,board\
	__asm movq mm0,[eax].whitePawns    \
	__asm pand mm0,zeroRight\
	__asm psllq mm0,7\
        __asm pand mm0,blackPieces											  	\
        __asm movq toMap,mm0                                \
}
#define gBlackPawnCapsLeft     \
{																						\
	__asm mov eax,board\
	__asm movq mm0,[eax].blackPawns    \
	__asm pand mm0,zeroRight\
	__asm psrlq mm0,9\
        __asm pand mm0,whitePieces											  	\
        __asm movq toMap,mm0                                \
}
#define gRookQueenMoves(fs)    \
{																						\
        __asm mov eax,board\
	__asm movq mm0,[eax].rot90cClock\
	__asm mov ebx,fs\
	__asm shl ebx,2\
	__asm movd mm1,[vertShift+ebx]\
	__asm psrlq mm0,mm1\
	__asm pand mm0,maskFF\
	__asm movd mm2,[horizShift+ebx]\
	__asm movq mm3,allPieces\
	__asm psrlq mm3,mm2\
	__asm pand mm3,maskFF\
	__asm shl ebx,9\
	__asm movd ecx,mm0\
	__asm shl ecx,3\
	__asm movq mm4,[rookMovesVert+ebx+ecx]\
	__asm movd ecx,mm3\
	__asm shl ecx,3\
	__asm movq mm5,[rookMovesHoriz+ebx+ecx]\
	__asm por mm4,mm5\
	__asm movq toMap,mm4\
}
#define gWhiteRookQueenCaps(fs)    \
{																						\
        __asm mov eax,board\
	__asm movq mm0,[eax].rot90cClock\
	__asm mov ebx,fs\
	__asm shl ebx,2\
	__asm movd mm1,[vertShift+ebx]\
	__asm psrlq mm0,mm1\
	__asm pand mm0,maskFF\
	__asm movd mm2,[horizShift+ebx]\
	__asm movq mm3,allPieces\
	__asm psrlq mm3,mm2\
	__asm pand mm3,maskFF\
	__asm shl ebx,9\
	__asm movd ecx,mm0\
	__asm shl ecx,3\
	__asm movq mm4,[rookAttacksVert+ebx+ecx]\
	__asm movd ecx,mm3\
	__asm shl ecx,3\
	__asm movq mm5,[rookAttacksHoriz+ebx+ecx]\
	__asm por mm4,mm5\
	__asm pand mm4,blackPieces\
	__asm movq toMap,mm4\
}
#define gBlackRookQueenCaps(fs)    \
{																						\
        __asm mov eax,board\
	__asm movq mm0,[eax].rot90cClock\
	__asm mov ebx,fs\
	__asm shl ebx,2\
	__asm movd mm1,[vertShift+ebx]\
	__asm psrlq mm0,mm1\
	__asm pand mm0,maskFF\
	__asm movd mm2,[horizShift+ebx]\
	__asm movq mm3,allPieces\
	__asm psrlq mm3,mm2\
	__asm pand mm3,maskFF\
	__asm shl ebx,9\
	__asm movd ecx,mm0\
	__asm shl ecx,3\
	__asm movq mm4,[rookAttacksVert+ebx+ecx]\
	__asm movd ecx,mm3\
	__asm shl ecx,3\
	__asm movq mm5,[rookAttacksHoriz+ebx+ecx]\
	__asm por mm4,mm5\
	__asm pand mm4,whitePieces\
	__asm movq toMap,mm4\
}

#define gBishopQueenMoves(fs)    \
{																						\
        __asm mov eax,board\
	__asm movq mm0,[eax].A1H8board\
	__asm mov ebx,fs\
	__asm shl ebx,2\
	__asm movd mm1,[A1H8shift+ebx]\
	__asm psrlq mm0,mm1\
	__asm pand mm0,[A1H8rotMask+ebx]\
	__asm movd mm2,[A8H1shift+ebx]\
	__asm movq mm3,[eax].A8H1board\
	__asm psrlq mm3,mm2\
	__asm pand mm3,[A8H1rotMask+ebx]\
	__asm shl ebx,9\
	__asm movd ecx,mm0\
	__asm shl ecx,3\
	__asm movq mm4,[movesA1H8+ebx+ecx]\
	__asm movd ecx,mm3\
	__asm shl ecx,3\
	__asm movq mm5,[movesA8H1+ebx+ecx]\
	__asm por mm4,mm5\
	__asm movq toMap,mm4\
}
#define gWhiteBishopQueenCaps(fs)    \
{																						\
        __asm mov eax,board\
	__asm movq mm0,[eax].A1H8board\
	__asm mov ebx,fs\
	__asm shl ebx,2\
	__asm movd mm1,[A1H8shift+ebx]\
	__asm psrlq mm0,mm1\
        __asm pand mm0,[A1H8rotMask+ebx]\
	__asm movd mm2,[A8H1shift+ebx]\
	__asm movq mm3,[eax].A8H1board\
	__asm psrlq mm3,mm2\
	__asm pand mm3,[A8H1rotMask+ebx]\
	__asm shl ebx,9\
	__asm movd ecx,mm0\
	__asm shl ecx,3\
	__asm movq mm4,[attacksA1H8+ebx+ecx]\
	__asm movd ecx,mm3\
	__asm shl ecx,3\
	__asm movq mm5,[attacksA8H1+ebx+ecx]\
	__asm por mm4,mm5\
	__asm pand mm4,blackPieces\
	__asm movq toMap,mm4\
}
#define gBlackBishopQueenCaps(fs)    \
{																						\
        __asm mov eax,board\
	__asm movq mm0,[eax].A1H8board\
	__asm mov ebx,fs\
	__asm shl ebx,2\
	__asm movd mm1,[A1H8shift+ebx]\
	__asm psrlq mm0,mm1\
        __asm pand mm0,[A1H8rotMask+ebx]\
	__asm movd mm2,[A8H1shift+ebx]\
	__asm movq mm3,[eax].A8H1board\
	__asm psrlq mm3,mm2\
	__asm pand mm3,[A8H1rotMask+ebx]\
	__asm shl ebx,9\
	__asm movd ecx,mm0\
	__asm shl ecx,3\
	__asm movq mm4,[attacksA1H8+ebx+ecx]\
	__asm movd ecx,mm3\
	__asm shl ecx,3\
	__asm movq mm5,[attacksA8H1+ebx+ecx]\
	__asm por mm4,mm5\
	__asm pand mm4,whitePieces\
	__asm movq toMap,mm4\
}



This page took 0.01 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.