<div dir="ltr">Hello,<div><br></div><div>From [1], trunc does not seems to have a nsw/nuw attribute.</div><div>Is it possible to have that? Or do we have that and it is not up-to-date?</div><div><br></div><div>The definition would be:</div><div><br></div><div>If the nuw keyword is present, the result value of the trunc is a poison value if the truncated high order bits are non-zero. If the nsw keyword is present, the result value of the trunc is a poison value if the truncated high order bits are not all equal to the non-truncated bit of the highest order.</div><div><br></div><div>This allow to cancel out:</div><div>- sext with trunc nsw</div><div>- zext with trunc nuw</div><div><br></div><div>And probably to commute with add/sub/mul/lshr/ashr/shl/urem/udiv/udiv (with the correct flags).</div><div><br></div><div>[1]: <a href="http://llvm.org/docs/LangRef.html#trunc-to-instruction">http://llvm.org/docs/LangRef.html#trunc-to-instruction</a><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><b>Alexandre Isoard</b><br></div></div>
</div></div>