Re: [RFC] LKMM: Add volatile_if()

Paul E. McKenney
2021-06-06T19:07:06Z

On Sun, Jun 06, 2021 at 08:17:40AM -0500, Segher Boessenkool wrote:
> On Sat, Jun 05, 2021 at 09:43:33PM -0700, Paul E. McKenney wrote:
> > So gcc might some day note a do-nothing asm and duplicate it for
> > the sole purpose of collapsing the "then" and "else" clauses. I
> > guess I need to keep my paranoia for the time being, then. :-/
>
> Or a "do-something" asm, even. What it does is make sure it is executed
> on the real machine exactly like on the abstract machine. That is how C
> is defined, what a compiler *does*.
>
> The programmer does not have any direct control over the generated code.

I am not looking for direct control, simply sufficient influence. ;-)

> > Of course, there is no guarantee that gcc won't learn about
> > assembler constants. :-/
>
> I am not sure what you call an "assembler constant" here. But you can
> be sure that GCC will not start doing anything here. GCC does not try
> to understand what you wrote in an inline asm, it just fills in the
> operands and that is all. It can do all the same things to it that it
> can do to any other code of course: duplicate it, deduplicate it,
> frobnicate it, etc.

Apologies, that "assembler constants" should have been "assembler
comments".

Thanx, Paul