[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 6 Jun 2021 12:07:02 -0700
From: "Paul E. McKenney" <paulmck@...nel.org>
To: Segher Boessenkool <segher@...nel.crashing.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Alan Stern <stern@...land.harvard.edu>,
Peter Zijlstra <peterz@...radead.org>,
Will Deacon <will@...nel.org>,
Andrea Parri <parri.andrea@...il.com>,
Boqun Feng <boqun.feng@...il.com>,
Nick Piggin <npiggin@...il.com>,
David Howells <dhowells@...hat.com>,
Jade Alglave <j.alglave@....ac.uk>,
Luc Maranget <luc.maranget@...ia.fr>,
Akira Yokosawa <akiyks@...il.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-toolchains@...r.kernel.org,
linux-arch <linux-arch@...r.kernel.org>
Subject: Re: [RFC] LKMM: Add volatile_if()
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
Powered by blists - more mailing lists