[PATCH] D52416: Allow FP types for atomicrmw xchg

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 6 09:05:07 PST 2018


arsenm marked an inline comment as done.
arsenm added inline comments.


================
Comment at: lib/CodeGen/AtomicExpandPass.cpp:500
+
+  bool NeedBitcast = OrigTy->isFloatingPointTy();
+  if (NeedBitcast) {
----------------
jfb wrote:
> jyknight wrote:
> > arsenm wrote:
> > > jyknight wrote:
> > > > Add a comment here that this code can go away if the cmpxchg instruction adds support for floating point types.
> > > I think there might need to be a separate fcmpxchg instruction for that, unless you mean there will also be a version that treats the FP type here as integer in memory
> > No -- the intent is not to compare for floating-point-equality ala fcmp, but rather just as bit equality. (e.g. NaNs are equal to each-other when they have the same bit representation, and unequal if they do not)
> This is what various ISAs and programming languages do, so I support what James says :)
AMDGPU does also have fcmpxchg, which does an FP compare, with nans failing etc.


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

https://reviews.llvm.org/D52416





More information about the llvm-commits mailing list