[cfe-dev] Using C++11 <atomic> with Clang SVN
jyasskin at googlers.com
Thu Apr 19 15:17:53 PDT 2012
On Thu, Apr 19, 2012 at 3:11 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> On Thu, Apr 19, 2012 at 2:53 PM, Chandler Carruth <chandlerc at google.com>
>> On Thu, Apr 19, 2012 at 1:33 PM, Richard Smith <richard at metafoo.co.uk>
>>> We do not claim that strong compare-exchange is listed as supported
>>> because the strong/weak distinction is not available in LLVM IR (we always
>>> generate a strong compare-exchange). Maybe we should just mark it as done to
>>> avoid confusion.
>> +1 -- the requirement should be for support of strong, not for
>> differentiation between strong and weak IMO...
> Marking more C++11 boxes as done is fine by me! In r155161.
> I was holding back from doing this before because the purpose of N2748 was
> to get better code for weak compare exchanges, which we don't actually do.
> That said, I have no idea if we support architectures for which there is a
> more efficient weak compare-exchange available.
My thought when designing this was that
1) It may well be possible for the backend to optimize strong cmpxchg
into weak cmpxchg in many of the important use cases. Someone should
try that before adding a new LLVM instruction.
2) The companies that develop or use architectures with a weak cmpxchg
(ARM, PPC, at least) can contribute the optimization when it matters
to them. Until then, it's simpler to have only one variant.
More information about the cfe-dev