This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: asm and "cc" "memory" volatile etc.. (slightly offtopic)
- To: Jan Hubicka <hubicka at atrey dot karlin dot mff dot cuni dot cz>
- Subject: Re: asm and "cc" "memory" volatile etc.. (slightly offtopic)
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Tue, 11 Nov 1997 10:59:21 -0700
- cc: egcs at cygnus dot com
- Reply-To: law at cygnus dot com
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