Given the size & scope of this change, it's definitely worth getting the details checked over as much as possible. The patch here is substantially the same as the one in the RFC thread, but tidied up and with a bit more testing.
This patch is minimal, in the sense that it exposes some interfaces to make "cmpxchg weak" usable, but doesn't actually do anything with them. It comes with a similarly minimal Clang patch that just makes it correctly use the strong cmpxchg again.
I'm expecting 3 following patches, though they'll all be fairly trivial and obvious once this is in place:
+ Use the "weak" in AtomicExpandLoadLinked. This gives us actual benefit from the construct.
+ Use the i1 in X86ISelLowering.cpp. This lets us skip some redundant comparisons.
+ Make clang emit "cmpxchg weak" when appropriate. It's almost all wired up already; just a few extra lines and a bunch of tests.
OK to commit?