<div dir="ltr">Doh!  I was thinking in one's complement, even though I know perfectly well that LLVM and almost all contemporary CPUs use two's complement.  Thank you!  :-)  <div><br></div><div><br></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">2013/11/25 Anton Korobeynikov <span dir="ltr"><<a href="mailto:anton@korobeynikov.info" target="_blank">anton@korobeynikov.info</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello<br>
<br>
> I was looking at "trunc" to downcast a signed integer, say sint32 to sint16,<br>
> but it seems to handle unsigned integers only.<br>
No. In twos-complement notation (which LLVM assumes) there no<br>
difference between signed and unsigned truncation - you just throw out<br>
the spare sign bits and that's all.<br>
<br>
Please note that that the "numbers" in LLVM IR is neither signed nor<br>
unsigned. They are just raw bits. It's up to the instruction in<br>
question how to interpret them. I'd suggest to clearly outline this in<br>
the document, since this is the important point.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
With best regards, Anton Korobeynikov<br>
Faculty of Mathematics and Mechanics, Saint Petersburg State University<br>
</font></span></blockquote></div><br></div>