Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Question to 64 bit experts

Author: Gerd Isenberg

Date: 13:58:01 01/19/05

Go up one level in this thread


On January 19, 2005 at 11:55:43, Rémi Coulom wrote:

>Hi,
>
>I am porting my chess program to 64 bit on an AMD64 Athlon processor. I have
>noticed that, with gcc, sizeof(int)=4. I would have expected sizeof(int)=8. On
>32-bit platforms, 32-bit variables are faster than 16-bit variables. I wonder if
>64-bit variables are faster than 32-bit variables on 64-bit machines. I have
>made a few experiments and did not notice much difference.
>
>Rémi

Hi Remi,

AMD64 avoids the "big waste" to move a lot of sign extended 64-bit values around
with probably only less than 32 bit significant digits.

In 64 bit mode it is still a "kind of native" 32-bit cpu with the well known
eax,ebx,ecx,edx,esi,edi,ebp,esp registers - and mostly the same instructions set
and opcode as in 32-bit mode, except 64-bit addressing (via registers) and using
the 8 additional gp-registers as 32-bit, eg.:

mov eax, dword ptr [4*rax+rdi]

All upper 32-bit of the 64-register is implicitely cleared, if target register
of an usual 32-bit instruction - without any penalty.
Operating with 64-bit instructions, using rax,rbx,rcx,rdx,rsi,rdi,rbp,rsp and
r8-r16, require one or two aditional prefix bytes, like:

mov r10, qword ptr [4*rax+rdi]

For usual integer ranges it is a good idea to keep int 32-bit.
Most compact and fastest code with the old and compatible 32-bit registers.

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.