Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: local/temporary labels in gcc inline assembly

Author: Dieter Buerssner

Date: 16:12:19 12/09/02

Go up one level in this thread


On December 09, 2002 at 17:49:00, Matt Taylor wrote:

I think, we all pretty much agree.

>The xchg instruction doesn't need a lock prefix because the lock is implicit.

Thanks for pointing this out. Is the implicit lock dependent on the actual
register used?

>don't think gcc actually requires that. Routines that use instructions like "rep
>stosb" would become very complicated very quickly.

Why should this become very complicated. I actually coded (years ago) a lot of
inline assembly using the "string" upcodes (move, store, compare, perhaps more I
forgot). I had not much of a problem with it. One simple "memory" in the clobber
list should be enough. At some time, gcc changed very much the syntax (I know it
is not the correct term, but I forgot the right word ...) of the asm(). It did
not allow anymore to put some registers (the output registers?) into the clobber
list. This was valid before. One had to rewrite any inline asm, that used this
with "tricks" similar to the one Robert showed in his code sample - by using a
dummy variable. Also, some subtle bugs could evolve, by forgetting the "&"
constraint then. Sometimes the code could work, sometimes not. I think the idea
behind Gcc inline assembly is very flexible, but it certainly is not easy to use
it without going through some tedious learning.

>Also, the volatile pointer
>should force the compiler to reload the memory anyway.

Perhaps, perhaps not. I gave a little comment in another post. I cannot
remember, that this is well defined in the documentation. I should not hurt, to
add "memory", anyway.

BTW. After "rep", gas wants a semicolon.

Regards,
Dieter




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.