This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/3] powerpc: POWER8 fmod optimization

On 11-11-2014 19:28, Joseph Myers wrote:
> On Tue, 11 Nov 2014, Adhemerval Zanella wrote:
>> +	mtfsb0  4*cr7+lt	/* Disable FE_INEXACT exception  */
> Disable trapping?  If you disable trapping, you need to restore the 
> previous state of that bit before returning.
>> +	fdiv    fp0,fp1,fp2	/* fp0 = -trunc (fp1 / fp2)  */
>> +	fneg    fp0,fp0
>> +	friz    fp0,fp0
>> +	fmadd   fp2,fp0,fp2,fp1 /* fp2 = x - (fp0) * y  */
> Are you sure this is correct when the integer quotient is not exactly 
> representable in IEEE double?  I'd expect you to need a loop in the case 
> of large exponent differences.

Indeed I overlook it, as I am seeing now with a more extensive testing.  Checking now,
it seems using a FP division operation in the loop to correct it not the best
strategy to achieve better performance.

>> +	fcpsgn  fp1,fp1,fp2
>> +	mtfsb0  4*cr1+eq	/* Clear any FE_INEXACT exception  */
> Clear any FE_INEXACT bit, whether or not set before the function?  It's 
> not correct for <math.h> functions to clear exception bits that were 
> already set - only bits they set, if previously clear.  (See bug 15491 for 
> such a bug in x86 nearbyint.)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]