This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: basic asm and memory clobbers
- From: Bernd Edlinger <bernd dot edlinger at hotmail dot de>
- To: Jeff Law <law at redhat dot com>, David Wohlferd <dw at LimeGreenSocks dot com>, "Segher Boessenkool" <segher at kernel dot crashing dot org>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, "rth at gcc dot gnu dot org" <rth at gcc dot gnu dot org>, "pinskia at gcc dot gnu dot org" <pinskia at gcc dot gnu dot org>, "Sandra Loosemore" <sandra at codesourcery dot com>
- Date: Fri, 27 Nov 2015 09:26:40 +0000
- Subject: Re: basic asm and memory clobbers
- Authentication-results: sourceware.org; auth=none
- Authentication-results: gcc.gnu.org; dkim=none (message not signed) header.d=none;gcc.gnu.org; dmarc=none action=none header.from=hotmail.de;
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:23
Hi,
On Tue, 17 Nov 2015 14:31:29, Jeff Law wrote:
> The benefit is traditional asms do the expected thing. With no way to describe dataflow, the only rational behaviour for a traditional asm is that it has to be considered a
use/clobber of memory and hard registers.
I'd like to mention here, that there is also another use-case for a basic asms:
It is most often used as a fairly portable memory barrier like this:
x = 1;
asm(""); // memory barrier
y = 2;
that is also the reason why every basic asm is implicitly a volatile asm.
Bernd.