This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: basic asm and memory clobbers


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.

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