This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: basic asm and memory clobbers
- From: Ian Lance Taylor <iant at google dot com>
- To: Paul_Koning at dell dot com
- Cc: David Wohlferd <dw at limegreensocks dot com>, GCC Development <gcc at gcc dot gnu dot org>
- Date: Tue, 24 Nov 2015 09:49:01 -0800
- Subject: Re: basic asm and memory clobbers
- Authentication-results: sourceware.org; auth=none
- References: <564AC155 dot 4040601 at LimeGreenSocks dot com> <564B9CB1 dot 1060001 at redhat dot com> <564E762B dot 6070705 at LimeGreenSocks dot com> <564EF338 dot 4030703 at redhat dot com> <564EF7FF dot 1070107 at LimeGreenSocks dot com> <564F008B dot 8040703 at redhat dot com> <564F1436 dot 2060005 at LimeGreenSocks dot com> <564F1A7D dot 9050607 at redhat dot com> <20151120152039 dot GA15922 at gate dot crashing dot org> <564F3C6E dot 5010908 at redhat dot com> <20151120153431 dot GJ5675 at tucnak dot redhat dot com> <564F46CF dot 2030403 at redhat dot com> <564FB2ED dot 70803 at LimeGreenSocks dot com> <56506A03 dot 7030609 at LimeGreenSocks dot com> <5652E4A6 dot 9090905 at redhat dot com> <56537921 dot 9070809 at redhat dot com> <565386CA dot 8080005 at LimeGreenSocks dot com> <C080D84D-C192-46F6-BAE9-9E3B5A9F766C at dell dot com> <5653BFC5 dot 5080305 at LimeGreenSocks dot com> <54275115-454B-4CCB-BEA8-752A14B24E62 at dell dot com>
On Tue, Nov 24, 2015 at 8:58 AM, <Paul_Koning@dell.com> wrote:
>
> I'm really concerned with loosening the meaning of basic asm. I
> wish I could find the documentation that says, or implies, that it
> is a memory clobber. And/or that it is implicitly volatile.
The volatile one is right there in the current docs.
https://gcc.gnu.org/onlinedocs/gcc/Basic-Asm.html#Basic-Asm
"All basic asm blocks are implicitly volatile."
Even back in GCC 2.95.3, the docs say
(https://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_4.html#SEC93) "If you
write an asm instruction with no outputs, GNU CC will know the
instruction has side-effects and will not delete the instruction or
move it outside of loops" and "An asm instruction without any operands
or clobbers (and "old style" asm) will not be deleted or moved
significantly, regardless, unless it is unreachable, the same wasy as
if you had written a volatile keyword."
However, I'm not aware that basic asm's were ever implicitly memory
clobbers. Again, back in GCC 2.95.3: "If your assembler instruction
modifies memory in an unpredictable fashion, add `memory' to the list
of clobbered registers."
Ian