<div><div dir="auto">Have you posted this on the libcxx-dev list? You might have more luck there.</div></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jan 4, 2020 at 11:10 AM Ben Trapani via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Any update on this? What are your thoughts?<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Dec 28, 2019 at 8:23 PM Ben Trapani <<a href="mailto:ben.trapani1995@gmail.com" target="_blank">ben.trapani1995@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I have started working on an implementation of atomic_ref. Implementing this requires performing atomic operations on arbitrary references. The behavior is undefined if a reference is provided that is not aligned per the public export required_alignment. What assumptions do the __c11_atomic builtins make about destination argument alignment, format, size etc.? Is it required that the destination argument be annotated as _Atomic like the corresponding standard c11 functions require? <br></div><div><br></div><div>The following code in libcxx/include/config implies that the c11 atomic builtins should be substituted for gcc atomic builtins if present:</div><div><br></div><div>#if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic) </div># define _LIBCPP_HAS_C_ATOMIC_IMP <br>#elif defined(_LIBCPP_COMPILER_GCC) <br># define _LIBCPP_HAS_GCC_ATOMIC_IMP <br><div>#endif</div><div><br></div><div>To implement atomic_ref, it might be cleaner to use the gcc builtins. By doing so, we avoid depending on the internals of the c11 atomic builtins. The required alignment of referenced variables would always be the first power of 2 >= max(type_size, type_alignment). Alternatively, we could use the c11 atomic builtins when available if it is enough to require that the input reference is aligned as the atomic type would be. What are your thoughts?</div><div><br></div><div>Regards,</div><div>Ben<br></div></div>
</blockquote></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div>