[PATCH] D137361: IR: Add atomicrmw inc and dec

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 3 15:54:22 PDT 2022


jdoerfert added a comment.

I'm very much in favor. One question, should it be `uinc` and `udec`, just for consistency? I guess we can simply add nvptx support afterwards too (@tra).



================
Comment at: llvm/docs/LangRef.rst:10524
+-  inc: ``*ptr = (old >= val) ? 0 : (*ptr + 1)``
+-  dec: ``*ptr = (*ptr == 0) || (*ptr > v)) ? val : (val - 1)``
 
----------------
Mark the comparisons as unsigned.


================
Comment at: llvm/include/llvm/IR/Instructions.h:770
+    /// Decrement one until a minimum value or zero.
+    /// *p = (old == 0) || (old > v)) ? v : (v - 1)
+    Dec,
----------------
Mark the comparisons as unsigned.


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

https://reviews.llvm.org/D137361



More information about the llvm-commits mailing list