Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: How long to build your chess engine [attn: nalimov]

Author: Anthony Cozzie

Date: 08:08:32 01/06/04

Go up one level in this thread


>>It isn't.  Bitboards are slower than attack tables on 32 bit hardware.  For
>>example, a 64 bit shift on 32 bit hardware is something like 10 instructions and
>>includes a conditional branch.
>
>On x86-32 64-bit shift are two instructions only, 7 bytes opcode:
>
>shld        edx,ecx,9
>shl         ecx,9
>
>shrd        ecx,edx,7
>shr         edx,7

This is how VC7 codes up a 64 bit shift:

_allshr PROC NEAR

;
; Handle shifts of 64 bits or more (if shifting 64 bits or more, the result
; depends only on the high order bit of edx).
;
        cmp     cl,64
        jae     short RETSIGN

;
; Handle shifts of between 0 and 31 bits
;
        cmp     cl, 32
        jae     short MORE32
        shrd    eax,edx,cl
        sar     edx,cl
        ret

;
; Handle shifts of between 32 and 63 bits
;
MORE32:
        mov     eax,edx
        sar     edx,31
        and     cl,31
        sar     eax,cl
        ret

;
; Return double precision 0 or -1, depending on the sign of edx
;
RETSIGN:
        sar     edx,31
        mov     eax,edx
        ret

anthony



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.