This is the mail archive of the 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

On Thu, Nov 19, 2015 at 05:23:55PM -0800, David Wohlferd wrote:
> For that reason, I'd like to propose adding 2 new clobbers to extended 
> asm as part of this work:
> "clobberall" - This gives extended the same semantics as whatever the 
> new basic asm will be using.
> "clobbernone" - This gives the same semantics as the current basic asm.

I don't think this is necessary or useful.  They are also awful names:
"clobberall" cannot clobber everything (think of the stack pointer),
and "clobbernone" does clobber some (those clobbered by any asm),

> Clobbernone may seem redundant, since not specifying any clobbers should 
> do the same thing.  But actually it doesn't, at least on i386.  At 
> present, there is no way for extended asm to not clobber "cc".  I don't 
> know if other platforms have similar issues.

Some do.  The purpose is to stay compatible with asm written for older
versions of the compiler.

> When basic asm changes, I expect that having a way to "just do what it 
> used to do" is going to be useful for some people.

24414 says the documented behaviour hasn't been true for at least
fourteen years.  It isn't likely anyone is relying on that behaviour.

> but perhaps the solution here is to just say that it doesn't 
> clobber flags (currently the most common case?), and update the docs if 
> and when people complain?  Yes, that's bad, but saying nothing at all 
> isn't any better.  And we know it's true for at least 2 platforms.

Saying nothing at all at least is *correct*.

It isn't necessary for users to know what registers the compiler
considers to be clobbered by an asm, unless they actually clobber
something in the assembler code themselves.  They can write extended
asm in that case.

Maybe you can put that in the doc?  "If you modify any register or
memory, use an extended asm"?  Jeff, do you agree with that?


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