Atomics: emit "cmpxchg weak" where possible
authorTim Northover <tnorthover@apple.com>
Fri, 13 Jun 2014 19:43:04 +0000 (19:43 +0000)
committerTim Northover <tnorthover@apple.com>
Fri, 13 Jun 2014 19:43:04 +0000 (19:43 +0000)
commitcadbbe15375b20634854fa20c96f369754fa7456
tree2287c72201a45c108e0a632cd04d705ee1bfb170
parente50b2e44ef040b9ab67b107f35565d3d64344980
Atomics: emit "cmpxchg weak" where possible

Most builtins date from before the "cmpxchg weak" was a gleam in the
C++ committee's eye, so fortunately not much needs to change. But a
few of them *do* acknowledge that failure is possible.

For these, we'll emit the usual cartesian product of cmpxchg
operations if we can't statically determine weakness.  CodeGen can
sort it out later if the function gets inlined.

The only other non-trivial aspect of this is (I think) that we emit
the scalar expression for "IsWeak" once, at the beginning, and
propagate its value through the successive blocks. There's not much in
it, but it's slightly more consistent with the existing handling of
FailureOrder.

llvm-svn: 210932
clang/lib/CodeGen/CGAtomic.cpp
clang/test/CodeGen/atomic-ops.c
clang/test/CodeGen/big-atomic-ops.c