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

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 6 05:11:47 PST 2023


arsenm added inline comments.


================
Comment at: llvm/docs/LangRef.rst:10564
 -  fmin: ``*ptr = minnum(*ptr, val)`` (match the `llvm.minnum.*`` intrinsic)
+-  uinc_wrap: ``*ptr = (*ptr u>= val) ? 0 : (*ptr + 1)`` (increment value with wraparound to zero when incremented to input value)
+-  udec_wrap: ``*ptr = ((*ptr == 0) || (*ptr u> val)) ? val : (*ptr -   1)`` (decrement with wraparound to input value when decremented below zero).
----------------
foad wrote:
> I think "when incremented past input value" or "when incremented above input value" would be clearer. If `val` is 8 then `*ptr` can take on values 0..8, not just 0..7.
I copied this description ~verbatim from the documentation for the instruction 


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

https://reviews.llvm.org/D137361



More information about the llvm-commits mailing list