Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: An Opteron note

Author: Robert Hyatt

Date: 10:59:58 11/27/03

Go up one level in this thread


On November 27, 2003 at 00:02:03, Tom Likens wrote:

>On November 26, 2003 at 21:18:05, Robert Hyatt wrote:
>
>>I have been converting the X86.s file to work in 64 bit mode on the Opteron
>>system I am playing with.  And I must say that after studying the Opteron
>>64 bit instruction set, I'm impressed.
>>
>>First, all the old opcodes work..   mov, sub, bsf, etc..
>>
>>Second, the familiar 8 32-bit regs are still there.  But they can be
>>named %rax rather than %eax to stretch them to 64 bits.  Cute.  And
>>then there are 8 more registers you can use with the same old opcodes
>>and addressing modes.
>>
>>In short, it's well-thought-out and very easy to use.  I'll post some
>>performance later.  I have PopCnt(), FirstOne() and LastOne() working
>>fine.  After I finish the others, I'll see how much (if any) it speeds
>>things up.
>
>Couple of quick questions, since I intend to do this as well over the next
>few days.
>
>1) What compiler are you using?

gcc 3.2 as distributed with the 64-bit version of Suse.

>2) Are the above functions inline assembly or separate modules?

separate modules.  I (somewhere) have some inline functions I wrote
for Linux.  I'm trying to find those and convert them to 64 bit...


>3) What are you using as your reference for the AMD64 op-codes?

My head.  IE I am not using any new opcodes whatsoever.  If you know
the AT&T assembly format, things like

movl $4, %eax

becomes

movq $4, %rax

and so forth.  You change all the opcodes to end in q for 64 bit stuff,
and change the "e" to "r" to indicate 64 bit registers.  And then there are
8 new registers like %r9...

The main problem is that the current asm has to do things in two 32-bit
chunks, so I can't just convert instruction for instruction, without being
pretty ugly.  Another thing is that this version of gcc passes a single
argument through %rdi, rather than on the stack.  More efficient of course
since it now has 16 registers to twiddle with.  But it took me a bit of
debugging and finally compiling a small test driver with -S to figure out
why my code was failing.  8(%rsp) just doesn't cut it when the parameter
is stuck in %rdi.  :)

I figured gcc would pass arguments the same way, but apparently not.



>
>regards,
>--tom



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.