Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: MMX instructions for bitboards

Author: Gerd Isenberg

Date: 11:02:02 08/09/02

Go up one level in this thread


On August 08, 2002 at 23:54:10, Matthew McKnight wrote:

>the MMX registers seem to be a good place for optimizing a chess program.  Is
>anyone using these for quick ANDs or ORs?  Or is the lack of useful MMX
>instructions too inhibiting?
>
>the only place I can see a gain by processing many bitboards at once would be in
>attacks() by generating rank,file,and diags all at once in the MM registers, but
>i might just end up needing more instructions for the MMX operations
>
>Anyone trying this?
>
>Matt

I tried a lot, parallel popcount of up to four Bitboards, attack board
generation, parallel scan of Bitboards (LSB of 8 Byte with reset, silly idea -
may be OK if popcount is greater 32 in average, distributed on all ranks), and
obvious routines like this one (including inlines):

BitBoard CNode::GetAttackedBy(unsigned int sq) const
{
	return
             (RookAttacks(sq)   & RookMover())
	   | (BishopAttacks(sq) & BishopMover())
	   | (BPawnAttacks(sq)  & GetWPawnBB())
	   | (WPawnAttacks(sq)  & GetBPawnBB())
	   | (KnightAttacks(sq) & GetKnightBB())
	   | (KingAttacks(sq)   & GetKingBB())
	   ;
}

A waste of time. It was so disappointing, no speedup at all. So many vector path
instructions. Practically you have to use movq via memory to transfer standard
register to mmx or vice versa. Otherwise you have to use two slow movd vector
path instructions with this punpckhdq or punpckldq (i like the mmx mnemonics so
much).

The mmx instruction set is not so stringent as i want, eg. i miss the shift
(psrlb mmx,const) instruction to shift logically right or left 8 bytes all at
once.

I throw all the mmx stuff out of my program, looking for hammer with sixteen 64
bit registers and an appropriate compiler.

Gerd



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.