[PATCH] D71726: Let clang atomic builtins fetch add/sub support floating point types

JF Bastien via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 20 18:48:36 PDT 2020


jfb added a comment.

In D71726#2047566 <https://reviews.llvm.org/D71726#2047566>, @ldionne wrote:

> In D71726#1791904 <https://reviews.llvm.org/D71726#1791904>, @jfb wrote:
>
> > This generally seems fine. Does it work on most backends? I want to make sure it doesn't fail in backends :)
> >
> > Also, @ldionne / @EricWF / @mclow.lists do you need this in libc++ for floating-point atomic support?
>
>
> Yes, I guess we do in order to implement `fetch_add` & friends on floating point types (https://wg21.link/P0020R6).
>
> The builtins would need to work on `float`, `double` and `long double`. The code seems to suggest it does, however the tests only check for `float`. Does this support `__atomic_fetch_{add,sub}` on `double` and `long double`?


libc++ could implement `atomic<float>` using a cmpxchg loop with `bit_cast` and the FP instruction in most cases, and only use these builtins if available.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71726/new/

https://reviews.llvm.org/D71726





More information about the cfe-commits mailing list