This is the mail archive of the gcc@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 - Proposed solution


On 13/12/15 06:15, David Wohlferd wrote:
> 
> However breakage and performance issues can still result solely from 
> adding memory clobbers. 

Breakage?  Really?

> And as I mentioned, "just memory clobber" may 
> not be the behavior people expect.  And if we aren't solving that, might 
> there be a second update later to add registers?  Talk about confusing 
> semantics...

No, there will not be.

>> It allows basic asm to be used in a sensible way by pushing and
>> popping all used registers.
> 
> If I were using basic asm, this would indeed seem like a sensible approach.
> 
> However, it is not the most efficient.  If I can clobber registers, 
> push/pop are just wasted cycles.  This just seems like another argument 
> for deprecating basic asm and pushing people to extended.

Yes.  I am not arguing against deprecation.  We should do that.

> ----------------------
> Imagine for a moment:
> 
> If the only way right now to do inline asm in gcc was extended, and I 
> proposed adding basic, how could I justify this 'new' feature?

You couldn't.  It's legacy-only.

> Contra-wise, what if starting today all new inline asm were written 
> using extended?  How would that be a bad thing?

It would not.  You are arguing against a position that no-one holds.

> Which means (to me), the only real justification for the continued
> existence of basic asm is backward compatibility.  Which makes the
> arguments for changing its behavior (whether a little or a lot)
> kinda weird.

No, it does not make them weird at all.  All it does is make an
existing feature safer.

> I still vote for doing everything we can think of to discourage people 
> from using basic and begin using extended:
> 
> - Change the docs to flat out deprecate basic (excluding top-level).

OK.

> - Add the warning so people's integrated dev environments will show the 
> suspect lines.

OK, if the warning is optional.

> - Make the warning a default, but overridable (-Wno-only-top-basic-asm), 
> so people who HAVE to support the old syntax still can.

That's a little more dubious.  Maybe.

> - Make sure the docs for the warning describe (link to?) how to change 
> asm from basic to extended and why.
> - Any bugs people report or posts people make involving basic asm get 
> resolved as 'Try it with extended.'

> I'm just afraid that instead of pursuing any of these solutions, we
> are going to pursue Solution #0: Do nothing.  A rather unsatisfying
> outcome after all this effort.

You can't simultaenously insist that it gets fixed the way you want
and complain about the difficulty of reaching consensus, y'know.  :-)

A basic asm which clobbers memory and saves registers has no
correctness problems whatsoever.  There is no reason that people
should not use it, and continue to use it if it suits them.

Andrew.


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