[PATCH] D137361: IR: Add atomicrmw inc and dec
Nicolai Hähnle via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 3 23:06:40 PDT 2022
nhaehnle added a comment.
I've only looked at the LangRef and header, but the direction makes sense to me.
================
Comment at: llvm/docs/LangRef.rst:10524
+- inc: ``*ptr = (old >= val) ? 0 : (*ptr + 1)``
+- dec: ``*ptr = (*ptr == 0) || (*ptr > v)) ? val : (val - 1)``
----------------
jdoerfert wrote:
> tra wrote:
> > `v` -> `val` ?
> Mark the comparisons as unsigned.
Should be `*ptr - 1`
================
Comment at: llvm/include/llvm/IR/Instructions.h:766
+ /// Increment one up to a maximum value.
+ /// *p = (old >= v) ? 0 : (old + 1)
+ Inc,
----------------
tra wrote:
> Source of `old`? In the examples above it was a parameter to `minnum/maxnum`. Nere it should probably be `*p`.
It's fine, `old` is used consistently here.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137361/new/
https://reviews.llvm.org/D137361
More information about the llvm-commits
mailing list