[LLVMdev] convert integer to double "uitofp" or "sitofp" ?

Jimborean Alexandra xinfinity_a at yahoo.com
Fri Oct 21 02:59:07 PDT 2011


Hello,

As I understand, in LLVM IR it cannot be determined whether a register of type int is signed or unsigned.
If one wants to convert an integer to a double, which instruction should be used:  "uitofp"  or "sitofp" ?


We track the values taken by all load instructions and we process them using a function. If the value is a pointer, we use int64 as the type of the function argument.
But in case the load instruction loads from a scalar, we need to convert it to a unique type, which we chose to be DoubleTy and use a function that expects a double as parameter.

Hence, we need to convert integers of various sizes to double. Is it possible to detect which instruction should be  used ("uitofp"  or "sitofp" )?

Thank you,
Alexandra
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111021/a3ce4164/attachment.html>


More information about the llvm-dev mailing list