RFC: add "cmpxchg weak" to LLVM IR

Tim Northover t.p.northover at gmail.com
Fri Jun 13 03:00:26 PDT 2014

Hi Chandler,

> So, I see where you're going here, but I'm curious -- why not just switch
> ATOMIC_CMP_SWAP to have a second i1 value, and still be strong? Is this
> *just* to support expanding? I wonder if that's really useful rather than
> just lowering it directly on the various targets....

I tried that originally, but quickly got into murky waters with all
the targets I've got basically no clue about.

It still could have been the best option (I started poking at Mips),
but for one particularly nasty facet: you can select ATOMIC_CMP_SWAP
in TableGen, but not ATOMIC_CMP_SWAP_WITH_SUCCESS (multiple results
and all that).

That means even getting selection back to the status quo would have
been a lot of duplicated C++ code in multiple targets, all for what's
basically a dead-end in most cases. It's far easier to make use of the
i1 before the DAG level if possible.

Anyway, that was my reasoning. Possibly more pragmatism than principle.



More information about the llvm-commits mailing list