[cfe-dev] FYI, Intel folks might be looking to add the __iso_volatile_Xxx family for MSVC STL <atomic> soon
JF Bastien via cfe-dev
cfe-dev at lists.llvm.org
Tue Jul 30 20:43:26 PDT 2019
> On Jul 30, 2019, at 5:21 PM, Eli Friedman via cfe-dev <cfe-dev at lists.llvm.org> wrote:
>
> From: cfe-dev <cfe-dev-bounces at lists.llvm.org <mailto:cfe-dev-bounces at lists.llvm.org>> On Behalf Of Reid Kleckner via cfe-dev
> Sent: Tuesday, July 30, 2019 4:54 PM
> To: Billy O'Neal (VC LIBS) <bion at microsoft.com <mailto:bion at microsoft.com>>
> Cc: cfe-dev <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>>
> Subject: [EXT] Re: [cfe-dev] FYI, Intel folks might be looking to add the __iso_volatile_Xxx family for MSVC STL <atomic> soon
>
> On Tue, Jul 30, 2019 at 4:15 PM Billy O'Neal (VC LIBS) <bion at microsoft.com <mailto:bion at microsoft.com>> wrote:
> > we can worry about optimization, perhaps using _Atomic, later
>
> We can’t use _Atomic because it would not be ABI compatible with our std::atomic; in particular, because we put the spinlock for non-lock-free atomics inside the atomic, for instance. And because that isn’t a thing for some of our supported frontends.
>
> It is possible that there are different intrinsics we could call for Clang that would make you folks happier, but we don’t know what those are or even if they exist at present.
>
> I was thinking that perhaps the _Atomic_address_as template would do the necessary casts to use it when necessary without changing the storage type inside the std::atomic object.
>
> There are actually multiple APIs to access C++11 atomics in clang, since we invented APIs in parallel with gcc. The __atomic_* builtins (https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html <https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html>) don’t require the use of _Atomic types.
>
> Using volatile loads and stores with barriers probably prevents the compiler from performing any breaking optimizations, assuming the RMW atomics are protected appropriately, and the user doesn’t call any of the clang atomic builtins directly. But it’s not a good idea; it won’t optimize well. For example, on AArch64, it will prevent the compiler from using the dedicated load-acquire and store-release instructions.
TL;DR: what are these _iso_ things? I read the bug report, I don’t see the details I’d expect.
I think the __atomic_* builtins should work as Eli suggests.
> -Eli
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev <https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190730/a33c1a13/attachment.html>
More information about the cfe-dev
mailing list