[PATCH] D52807: [COFF, ARM64] Add _InterlockedCompareExchangePointer_nf intrinsic

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 3 12:03:57 PDT 2018


efriedma added inline comments.


================
Comment at: lib/CodeGen/CGBuiltin.cpp:3003
+  case Builtin::BI_InterlockedCompareExchangePointer:
+  case Builtin::BI_InterlockedCompareExchangePointer_nf: {
     llvm::Type *RTy;
----------------
mgrang wrote:
> rnk wrote:
> > Is the no fence version really equivalent to this seq_cst version here?
> I don't see InterlockedCompareExchangePointer creating a fence but it should. (since it is the fence version). So maybe that needs to be fixed (and possibly other fence functions).
> 
> InterlockedCompareExchangePointer_nf should not create a fence so the current implementation seems correct.
"create a fence" is a little confusing because the AArch64 ldaxr/stlxr have builtin fences... but presumably the "nf" version should use ldxr/stxr instead.  At the IR level, that corresponds to "monotonic".


Repository:
  rC Clang

https://reviews.llvm.org/D52807





More information about the cfe-commits mailing list