This is the mail archive of the libc-alpha@sourceware.org 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 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.

> +	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.)

-- 
Joseph S. Myers
joseph@codesourcery.com


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