Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Expert Assembler Question

Author: Gerd Isenberg

Date: 13:48:00 08/27/05

Go up one level in this thread


On August 27, 2005 at 15:38:21, Mridul Muralidharan wrote:

>Interesting comments Gerd , thanks a lot - I was not aware of some of this :)
>
>Regards,
>Mridul

Hi Mridul,

IMHO it is important for all scalar, global as well as local vars and parameter
_not_ to use short or char variables, even if the value range would perfectly
fit. Also for alignment reasons. SIMD, eg. registers with arrays of bytes/shorts
is another issue.

One may argue that using byte registers may increase the number of available
registers ax,bx,cx,dx -> x->h,l. An experienced assembler programmer may
outperform the compiler in this area - anyway partial byte registers have some
additional drawbacks. h and l registers are not independent, they stall.
And for x86-64, 8-bit operations often imply considerable more amount of
computation ressources (like additional shift/and) or are even sometimes
"emulated" with vector path instructions.

Some often used 64-256 sized arrays with native ints in C are most often faster
than withs bytes (chars). I guess, except for some patological cases, that is
true for most current >= 32-bit architectures, most likely for x86-64.

As allways, if total memory size of "often" used memory increases some
"critical" margin, things may start behave chaotically (cache trashing).

What i dont really like with ms x86-64 compiler is the "new" calling convention
(not sure for other compilers, but i guess it is all the same, masm as well).
Callee has to reserve stack for the called routine to (eventuelly) save up to
four 64-bit registers. If the called routine didn't use that space - wasted, and
some additional cachelines are needed for the stack. May be Eugene can explain
the possible advantages of those calling conventions - i don't get it yet.

Cheers,
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.