This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]