This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
asm load/store
- From: Dale Johannesen <dalej at apple dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Fri, 2 Aug 2002 15:34:25 -0700
- Subject: asm load/store
Is it true that an asm() that is actually a load or store, and
for which it's impossible to figure out exactly which memory it
touches by examining the arguments, must be declared "volatile"
to work correctly? It would be nice to have something that
doesn't disable the optimizer so completely yet gets the semantics
right. I suppose the declaration to clobber "memory" started out
as an attempt to model a store, but it doesn't work, and from the
current docs is apparently not expected to work:
asm (clobbers memory)
store (non-asm)
asm (clobbers memory, identical to above)
cse removes the 2nd asm (sharing it with the first). If it
thought that clobbering memory==store, it could not do that.