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

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 5 23:37:45 PDT 2021


rjmccall added a comment.

Alright, mostly looks good.



================
Comment at: clang/lib/Sema/SemaChecking.cpp:5011
+        !ValType->isFloatingType()) {
+      Diag(ExprRange.getBegin(), diag::err_atomic_op_needs_atomic_int_ptr_or_fp)
           << IsC11 << Ptr->getType() << Ptr->getSourceRange();
----------------
yaxunl wrote:
> rjmccall wrote:
> > yaxunl wrote:
> > > rjmccall wrote:
> > > > Does LLVM support atomics on all floating-point types?
> > > LLVM IR parser requires atomicrmw value operand must have size of power of 2, therefore LLVM does not support atomicrmw on x86_fp80 which has size of 80 bytes. LLVM supports atomicrmw on all other floating-point types (bfloat, half, float, double, fp128, ppc_fp128).
> > Okay.  So this needs to check the underlying FP semantics and disallow atomics on unsupported types.
> will do
Could you extract this whole condition into a function and make it a bit more readable?


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

https://reviews.llvm.org/D71726



More information about the cfe-commits mailing list