This is the mail archive of the
mailing list for the GCC project.
Re: basic asm and memory clobbers
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Jeff Law <law at redhat dot com>
- Cc: David Wohlferd <dw at LimeGreenSocks dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, rth at gcc dot gnu dot org, pinskia at gcc dot gnu dot org, Sandra Loosemore <sandra at codesourcery dot com>
- Date: Tue, 17 Nov 2015 19:28:03 -0600
- Subject: Re: basic asm and memory clobbers
- Authentication-results: sourceware.org; auth=none
- References: <563FE459 dot 3000003 at LimeGreenSocks dot com> <20151109093229 dot GA5260 at gate dot crashing dot org> <56493010 dot 9070707 at LimeGreenSocks dot com> <564A4AA5 dot 1080706 at redhat dot com> <564AC155 dot 4040601 at LimeGreenSocks dot com> <564B9CB1 dot 1060001 at redhat dot com>
On Tue, Nov 17, 2015 at 02:31:29PM -0700, Jeff Law wrote:
> >- There is a plausible work-around with extended asm, which (mostly) has
> >clear semantics regarding clobbers.
> Converting an old-style asm to extended asm can be painful. ANd in the
> case of legacy code the conversion process itself is a potential source
> of bugs.
> >- While the change probably won't introduce bad code, if it does it will
> >be in ways that are going to be difficult to track down, in an area
> >where few have the expertise to debug.
> >- Existing code that currently does things 'right' (ie push/pop any
> >modified registers) will suddenly be doing things 'wrong,' or at least
Basic asm does not do this, and hasn't for a very long time. So there
simply cannot be existing users that rely on this behaviour. fwprop1
removes the save/restore already, in most cases.
> The fact that it wasn't documented that way eons ago is simply a
> documentation bug -- likely due to the fact that back when the
> documentation for traditional asms was written, there were virtually no
> optimizations of memory referencing instructions -- essentially folks
> didn't ponder (much less document) how these asms would interact with
_Does_ basic asm as currently implemented have a memory clobber? If not,
it seems we can just remove basic asm completely and everything would
still work the same!