[llvm-dev] cmpxchg on floats

Joerg Sonnenberger via llvm-dev llvm-dev at lists.llvm.org
Sun Aug 23 08:49:26 PDT 2020


On Sun, Aug 23, 2020 at 02:44:57PM +0200, Nicolai Hähnle wrote:
> > Right and so it can fail as a weak cmpxchg does. It will pick up the
> > correct value in the next iteration. This is not really that different
> > from spurious failures of LL/SC etc.
> 
> Okay, I see what you mean. cmpxchg isn't weak by default though, so my
> assumption is that a potential fcmpxchg would be the same. Can we
> agree that your translation is correct for `fcmpxchg weak`, but not
> for default `fcmpxchg`? You can make it correct by wrapping it in a
> retry loop, at the cost of reducing performance even further compared
> to a native fcmpxchg.

Sure, the point where this all started was the absense of native
fcmpxchg. So the short summary is that we can easily extend the current
IR to allow float types and provide a sane lowering.

Joerg


More information about the llvm-dev mailing list