[LLVMdev] fptoui Semantics Question

Chris Lattner sabre at nondot.org
Fri Sep 21 20:15:21 PDT 2007


On Sep 21, 2007, at 6:18 PM, Dound wrote:
> I am a little confused by the results of the result of fptoui ...  
> seems to conflict with the instructions semantics as defined in the  
> language reference (http://llvm.org/docs/LangRef.html#i_fptoui ):
>
>   %tmp1001 = fptoui float 1.0E+300 to i1   ; % yields tmp1001 = 0  
> on my machine!
>
> but the ref says:
>
>    %Y = fptoui float 1.0E+300 to i1     ; yields i1:true

This is a bug in LangRef.html.

Originally, "cast to bool" was defined as a comparison against zero.   
Now, we expect you do to a comparison against zero, like this:

> (checked the return value with ... icmp eq i1 %tmp1001, 0 ... it is  
> returning true)

if you want those semantics.  This freed us to make the semantics of  
fptoui not have to special case bool (which has become i1).  The  
semantics of fptoui are that the result is undefined if the input  
doesn't fit into the result as an unsigned value.

I'll update the docs, thanks!

-Chris

> Any ideas?  Probably a really dumb mistake on my part, but it  
> certainly seems to me like it doesn't follow what the manual says.   
> I am using LLVM 2.0.
>
>
> Thanks ~ David
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20070921/529785f0/attachment.html>


More information about the llvm-dev mailing list