<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
I have a question about the semantics of the "urem a b" IR instruction when "a/b" is not representable.
<div><br>
</div>
<div>The language reference states that "This instruction returns the unsigned integer remainder of a division.</div>
<div>This instruction always performs an unsigned division to get the remainder."</div>
<div><br>
</div>
<div>It does not specify what it returns in if a/b is not representable. For example "udiv" definition says:</div>
<div>"If the exact keyword is present, the result value of the udiv is a poison value</div>
<div>if %op1 is not a multiple of %op2 (as such, "((a udiv exact b) mul b) == a")."</div>
<div><br>
</div>
<div>So it is internally calling "exact udiv", the poison value returned by it will cause "udev" return value to be a poison.</div>
<div>However, if it is not using "exact," I am not sure what the result would be.</div>
<div><br>
</div>
<div>Could somebody clarify the intended semantics or "urem" for me? Thanks!</div>
<div><br>
</div>
<span>Vadim</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
</body>
</html>