# Re: \[RFC\] LKMM: Add volatile\_if()

- From: Segher Boessenkool \<hidden\>
- Date: 2021-06-06 19:57:09 
- List: linux-arch
- Page: https://ratatoskr.run/linux-arch/2021/06/1404068
- Thread: https://ratatoskr.run/linux-toolchains/2021/06/1402437/t.md

```text
On Sun, Jun 06, 2021 at 11:48:32AM -0700, Linus Torvalds wrote:
> On Sun, Jun 6, 2021 at 11:43 AM Segher Boessenkool
> [ref] wrote:
> >
> > You truly should have written a branch in tthe asm if you truly wanted
> > a branch instruction.
> 
> That's exactly what I don't want to do, and what the original patch by
> PeterZ did.

Yes, I know.  But it is literally the *only* way to *always* get a
conditional branch: by writing one.

> And to work well, it needs "asm goto", which is so recent that a lot
> of compilers don't support it (thank God for clang dragging gcc
> kicking and screaming to implement it at all - I'd asked for it over a
> decade ago).

GCC has had it since 2009.

> So you get bad code generation in a lot of cases, which entirely
> obviates the _point_ of this all - which is that we can avoid an
> expensive operation (a memory barrier) by just doing clever code
> generation.
> 
> So if we can't get the clever code generation, it's all pretty much
> moot, imnsho.

Yes.


Segher
```
