[libc-commits] [PATCH] D145608: [libc] Add intrinsic for thread fence to the atomic support

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Mar 8 20:36:15 PST 2023


sivachandra added inline comments.


================
Comment at: libc/src/__support/CPP/atomic.h:97
+inline void atomic_thread_fence(MemoryOrder mem_ord) {
+  __atomic_thread_fence(int(mem_ord));
+}
----------------
jhuber6 wrote:
> lntue wrote:
> > Do we need a guard to check if the builtin `__atomic_thread_fence` is available?
> We use all the other intrinsics above, so as long as it supports the same built-ins that GNU does it should be provided.
> Also, should this function be `noexcept` or `always_inline`?
I am not really worried about the guard check because there is no alternative being proposed. But, this function should at the least use `LIBC_INLINE`. `noexcept` is optional as we build the libc with `-fno-exceptions` anyway.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145608



More information about the libc-commits mailing list