basic asm and memory clobbers

Bernd Edlinger bernd.edlinger@hotmail.de
Fri Nov 27 09:27:00 GMT 2015


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.


More information about the Gcc-patches mailing list