[LLVMdev] Need help in converting int to double

James Molloy James.Molloy at arm.com
Thu Sep 22 02:42:19 PDT 2011


Hi Sarath,

If you can only hold doubles (not integers), and you originally converted the doubles to integers to do an integer shift, why can you not just convert the result back to a double using CreateFPToSI ?

CreateFPToSI(CreateShr(CreateSIToFP(arg0), CreateSIToFP(arg1)))

Cheers,

James

From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of sarath chandra
Sent: 22 September 2011 10:37
To: llvmdev at cs.uiuc.edu
Subject: [LLVMdev] Need help in converting int to double

Hi,

     I'm pursuing M.Tech course. As a part of the project work i'm using LLVM as back-end. My project area is "Enhancing the performance of V8 javascript engine using LLVM as a back-end".

    Now i'm writing code for shift left(SHL) operator. I had my own Value Structure .. it's like this

Struct Value
{
void *val  ;
char type;
}

  The "char type" holds DoubleType,DoubleConst,StringType,StringConst...

  when i'm executing the IrBuilder.CreateShl(LHS,RHS) instruction it is returning an integer value as output.. i'm unable to store the value in my structure....(because my structure can hold Doubles,Strings).

  Is there any way to store the integer output in my structure( i used CreateSIToFP() to change int to double)........

Thanks in advance

Regards,

  (¨`·.·´¨)
   `·.¸(¨`·.·´¨)
  (¨`·.·´¨)¸.·´ Sarath!!!
    `·.¸.·´

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110922/1bcfbfea/attachment.html>


More information about the llvm-dev mailing list