lightning
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lightning] About jit_roundr_d_i


From: Paolo Bonzini
Subject: Re: [Lightning] About jit_roundr_d_i
Date: Fri, 10 Sep 2010 09:48:36 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Mnenhy/0.8.3 Thunderbird/3.0.5

On 09/10/2010 12:21 AM, Paulo César Pereira de Andrade wrote:
   The default implementation, assuming following the
"round" definition and default (round to nearest) rounding mode,
is actually wrong because of ties. The problem is that on
ties, "round" should round away from zero, but there is
no such rounding mode, only the default, towards zero.

True. Let's just document that round is the same as the C function rint. (Though, shouldn't it round to even?)

   BTW, is this really correct?
extr_d_f  o1 o2<- convert float o2 to double o1
extr_i_d  o1 o2<- convert int o2 to double o1

If extr_i_d means "int to double", then extr_d_f
should mean "double to float", and not "float to double"

Which it does:

#define jit_extr_d_f(rd, rs)    CVTSD2SSrr((rs), (rd))

SD2SS = scalar double to scalar float.

But for x87 they're all dummy.

(there is only FISTTP, no FISTT, so, need to
load the value, and pop it, instead of using
FXCH, but it should still be cheap as it does,
correctly, rounding towards zero on ties)

FISTTP is not on all processors though. At this point, it's easier to use SSE(2) for 32-bit too.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]