[PATCH] D137361: IR: Add atomicrmw uinc_wrap and udec_wrap

Jon Chesterfield via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 7 03:46:04 PST 2022


JonChesterfield added inline comments.


================
Comment at: llvm/docs/LangRef.rst:10471
+-  udec_wrap: ``*ptr = ((*ptr == 0) || (*ptr u> val)) ? val : (*ptr - 1)``
 
 Example:
----------------
The expressions here look suspicious - I thought these operated as inc/dec then modulo value. Does inc(p,10) really go to zero if p has the initial value 15? If so clamp might be a better name.

Likewise the ==0 in dec, though I think unsigned compare makes that expression work. Is it *ptr = ((*ptr -1) % val) ?




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

https://reviews.llvm.org/D137361



More information about the llvm-commits mailing list