[LLVMdev] sext..to instruction
Nick Lewycky
nicholas at mxc.ca
Mon Oct 6 09:52:24 PDT 2008
Le Anh Quang wrote:
> Hi,
> I have a question about the "sext..to" instruction. In the document, I found
> two examples:
> %x = sext i8 -1 to i16
> It means:
> i8 -1 = 1111 1111 --> 1111 1111 1111 1111 = i16
> how can it determinate, that the i16 value %x positive is (65535)?
i16 65536 = i16 -1. They're both 1111 1111 1111 1111.
> And the second example:
>
> %y = sext i1 true to i32
> 1 --> 1111 1111 1111 1111 1111 1111 1111 1111
> In this example, %y is -1
>
> I'm not sure about it, when sext to results a positve/negative value?
Since they're the same bits, it doesn't matter at all until you perform
you I/O, at which time your code makes the decision as to whether the
top bit should be treated as a sign bit or not.
The LangRef should probably be updated, as LLVM's AsmPrinter will never
print i16 65536, preferring to show all values as signed.
Nick Lewycky
> Thank for any advice
> Quang
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
More information about the llvm-dev
mailing list