[PATCH] D102449: [WIP][Clang][OpenMP] Add the support for compare clause in atomic directive

Shilei Tian via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 24 10:26:27 PDT 2021


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


================
Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:5775-5802
+static void emitOMPAtomicCompareExpr(CodeGenFunction &CGF,
+                                     llvm::AtomicOrdering AO, const Expr *X,
+                                     const Expr *E, const Expr *D,
+                                     const Expr *CE, bool IsXLHSInRHSPart,
+                                     SourceLocation Loc) {
+  assert(X->isLValue() && "X of 'omp atomic compare' is not lvalue");
+  assert(isa<BinaryOperator>(CE->IgnoreImpCasts()) &&
----------------
ABataev wrote:
> I would think about moving most of the atomic codegen functionality to common runtime/OMPBuilder part to be able to override implementation for different targets. It may help to avoid codegen problems with Nvidia/AMD GPUs. Not directly related to this patch though.
yeah, actually IIRC the `OMPIRBuilder` already supports atomic operations. Not sure if it supports the `compare` clause but I'll take a look. If not, I also think it's a better place to sit them.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102449



More information about the cfe-commits mailing list