[LLVMdev] x86 rounding mode question

Chris Lattner clattner at apple.com
Tue Sep 28 16:58:02 PDT 2010


On Sep 28, 2010, at 4:14 PM, Bob wrote:

> Hi,
>  
> Is there a recommended way to round to the nearest whole (x86 RC field of FPU control  = 00) ?
>  
> It appears an intentional truncation instruction is generated (if ms disassembly is correct):
>  
> IRBuilder<>::CreateFPToSI
>  
> %1 = fptosi double %0 to i64
>  
> 00370025  fisttp      qword ptr [esp]
>  

Hi Bob,

We don't have great support for this.  We support the rounding modes that C uses, but don't have the ability to control the rounding flags in the machine, and don't have a way to tell the optimizer that the program is fiddling with them.

-Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100928/86b554a6/attachment.html>


More information about the llvm-dev mailing list