Displaying 1 result from an estimated 1 matches for "__c11_compare_exchange_strong".
2014 May 29
4
[LLVMdev] Proposal: "load linked" and "store conditional" atomic instructions
...e optimisation opportunities
that LLVM *would* be able to exploit if it saw the control flow earlier.
For example the return value of the C++11 and C11 compare_exchange operations is
actually whether the exchange succeeded, which leads to some common idioms in
Clang-produced IR.
>From "if(__c11_compare_exchange_strong(...))":
%loaded = cmpxchg i32* %addr, i32 %oldval, i32 %newval seq_cst seq_cst
%success = icmp eq i32 %loaded, %oldval
br i1 %success, label %true, label %false
the control-flow here should be something like:
loop:
%loaded = load linked i32* %addr seq_cst
%trystore...