[LLVMdev] Need help in converting int to double

James Molloy James.Molloy at arm.com
Fri Sep 23 00:15:39 PDT 2011


Good to know, thanks.

The docs are slightly hazy on that - they do mention type-to-type if same size, but the examples are only between pointers and integers, not floats. Would it be worthwhile my updating the documentation to explicitly state that or is it just me?

Cheers,

James

-----Original Message-----
From: John McCall [mailto:rjmccall at apple.com]
Sent: 23 September 2011 00:06
To: James Molloy
Cc: sarath chandra; llvmdev at cs.uiuc.edu
Subject: Re: [LLVMdev] Need help in converting int to double

On Sep 22, 2011, at 3:32 AM, James Molloy wrote:
> It's in trouble by this point because it needs to do a fptosi on a double operand, but you've got an i64 operand and you can't reinterpret-cast ints to floats in LLVM IR (AFAIK)

You can bitcast ints to floats and vice-versa if they're the same size - for example, i32 to float and i64 to double.

John.


-- 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.





More information about the llvm-dev mailing list