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: Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: "GNU C. Library" <libc-alpha at sourceware dot org>
- Date: Wed, 12 Nov 2014 13:38:39 -0200
- 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> <alpine dot DEB dot 2 dot 10 dot 1411112120500 dot 12642 at digraph dot polyomino dot org dot uk>
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.)
>