[LLVMdev] Rounding Mode for fptrunc Instruction

Dale Johannesen dalej at apple.com
Tue Mar 11 14:49:52 PDT 2008


On Mar 11, 2008, at 2:25 PM, Jon Sargeant wrote:

> Hi,
>
> What is the rounding mode for the fptrunc instruction?  Round to zero?
> Round to nearest?  Or undefined?
>
> Regards,
> Jon

Rounding mode handling is currently primitive.  FPTRUNC is (de facto)  
round to nearest, as is the corresponding BE node FP_ROUND.   
FP_ROUND_IN_REG is round to nearest on X86 and round to zero on  
PowerPC.  Better would be to have the rounding mode attached to the  
nodes (or multiple nodes), but nobody's done it yet.  We are a long  
ways from having FENV_ACCESS work.




More information about the llvm-dev mailing list