This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 2/3] powerpc: POWER8 fmod optimization
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>
- Cc: "GNU C. Library" <libc-alpha at sourceware dot org>
- Date: Tue, 11 Nov 2014 21:28:37 +0000
- Subject: Re: [PATCH 2/3] powerpc: POWER8 fmod optimization
- Authentication-results: sourceware.org; auth=none
- References: <54627990 dot 1060805 at linux dot vnet dot ibm dot com>
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