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

Louis Dionne via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 21 11:54:06 PDT 2020


ldionne added inline comments.


================
Comment at: clang/test/CodeGen/atomic-ops.c:296
+  // CHECK: fsub
+  return __atomic_sub_fetch(p, 1.0, memory_order_relaxed);
+}
----------------
yaxunl wrote:
> ldionne wrote:
> > Sorry if that's a dumb question, but I'm a bit confused: `p` is  a `float*`, but then we add a double `1.0` to it. Is that intended, or should that be `double *p` instead (or `1.0f`)?
> In this case, the value type is converted to the pointee type of the pointer operand.
Ok, thanks for the clarification. Yeah, it was a dumb question after all. I still think it should be made clearer by using `1.0f`.


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

https://reviews.llvm.org/D71726





More information about the cfe-commits mailing list