]> granicus.if.org Git - clang/commit
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)
commit9478a68558c7ecd79d8017645537c69bb90d76f9
tree528a2f605fa840830665ad6b07b49d192ab3a292
parent43ada3da13132d6a056ff5304ec5bccda92bc6a5
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210932 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGAtomic.cpp
test/CodeGen/atomic-ops.c
test/CodeGen/big-atomic-ops.c