This is the mail archive of the gcc@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]

Re: asm and "cc" "memory" volatile etc.. (slightly offtopic)



  In message <19971111102912.23695@atrey.karlin.mff.cuni.cz>you write:
  > do I need to write "cc" into modified registers, since it changes flags?
  > is such construction w/o "cc" bug? 
I would think you should list "cc" in the clobbered registers.

  > I probably need to write "memory" since it modifies memory, but what
  > for example in memchr case, wich just reads memory, do I put there
  > "memory" too to force gcc update all memory locations (and do not store some data in registers)
  > 
  > Is there some way to say gcc, that is just updates given block of memory
  > (rtl expression for memcpy dont say clobbers:memory but says set BLK...
  > is there any way to write this in asm?)
I'm not aware of any way to selectively tell gcc that only a certain block
of memory is read/clobbered by an asm (or any BLKmode instruction).

This is something that has been talked about, but I don't see anything
happening in this area anytime soon.

  > When exactly I need to write volatile? Does memcpy implementation need
  > volatile or fact, that it changes memory is enought for gcc to do not
  > make "bad" optimizations?
  > What it memchr case?
  > I know that I need to write volatile in thinks like "cli" but it is require  > d
  > here too?
You can prevent an @code{asm} instruction from being deleted, moved
significantly, or combined, by writing the keyword @code{volatile} after
the @code{asm}.  For example:

So, if you need the asm to never be deleted, moved significantly or
combined, then you need the volatile.

jeff


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