[llvm-dev] urem instruction
Vadim Zaliva via llvm-dev
llvm-dev at lists.llvm.org
Thu Sep 30 18:36:32 PDT 2021
I have a question about the semantics of the "urem a b" IR instruction when "a/b" is not representable.
The language reference states that "This instruction returns the unsigned integer remainder of a division.
This instruction always performs an unsigned division to get the remainder."
It does not specify what it returns in if a/b is not representable. For example "udiv" definition says:
"If the exact keyword is present, the result value of the udiv is a poison value
if %op1 is not a multiple of %op2 (as such, "((a udiv exact b) mul b) == a")."
So it is internally calling "exact udiv", the poison value returned by it will cause "udev" return value to be a poison.
However, if it is not using "exact," I am not sure what the result would be.
Could somebody clarify the intended semantics or "urem" for me? Thanks!
Vadim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20211001/8d87c280/attachment.html>
More information about the llvm-dev
mailing list