Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Fast 3DNow! BitScan, one more faster

Author: Arshad F. Syed

Date: 18:04:54 12/01/02

Go up one level in this thread


I am not much of an expert on this, since I am just starting to get into
assembly programming. But I was curious about the dword used here, which implies
to me you are doing 32-bit stuff. Wouldn't it make life simpler to just get an
Itanium processor and switch to 64-bit code, which would cut down the cycles
used.

Regards,
Arshad


On December 01, 2002 at 17:05:06, Gerd Isenberg wrote:

>oups, something shorter and faster:
>
>int getBitIndex(BitBoard singleBit)
>{
>	__asm
>	{
>		pxor	mm2, mm2	; 0
>		movd		mm0, [singleBit]
>		punpckldq	mm0, [singleBit+4]
>		pcmpeqd	mm6, mm6	; -1
>		pxor	mm7, mm7	; 0
>		pcmpeqd	mm2, mm0	; ~mask of the none zero dword
>		PI2FD	mm1, mm0	; 3f8..,400..
>		pxor	mm2, mm6	; mask of the none zero dword
>		psrlq	mm6, 63		; 01
>		psrld	mm1, 23		; 3f8 to 7f
>		psrld	mm2, 25		; 7f mask
>		psllq	mm6, 32+5	; 20:00
>		psubd	mm1, mm2	; - 7f mask
>		por	mm1, mm6	; + 32 in high dword
>		pand	mm1, mm2	; & 7f mask
>		psadbw	mm1, mm7	; add all bytes
>		movd	eax, mm1
>	}
>}



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.