This is the mail archive of the glibc-bugs@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]

[Bug math/20157] [powerpc] fabsl (sNaN) wrongly raises "invalid"


https://sourceware.org/bugzilla/show_bug.cgi?id=20157

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  24e9ae1bc22796990ab70475b233beaf109d1cfb (commit)
      from  d8728df4306c07ed3dc64e825dec9f2e97cb826d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=24e9ae1bc22796990ab70475b233beaf109d1cfb

commit 24e9ae1bc22796990ab70475b233beaf109d1cfb
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Fri May 27 15:29:31 2016 +0000

    Avoid "invalid" exceptions from powerpc fabsl (sNaN) (bug 20157).

    The powerpc implementations of fabsl for ldbl-128ibm (both powerpc32
    and powerpc64) wrongly raise the "invalid" exception for sNaN
    arguments.  fabs functions should be quiet for all inputs including
    signaling NaNs.  The problem is the use of a comparison instruction
    fcmpu to determine if the high part of the argument is negative and so
    the low part needs to be negated; such instructions raise "invalid"
    for sNaNs.

    There is a pure integer implementation of fabsl in
    sysdeps/ieee754/ldbl-128ibm/s_fabsl.c.  However, it's not necessary to
    use it to avoid such exceptions.  The fsel instruction does not raise
    exceptions for sNaNs, and can be used in place of the original
    comparison.  (Note that if the high part is zero or a NaN, it does not
    matter whether the low part is negated; the choice of whether the low
    part of a zero is +0 or -0 does not affect the value, and the low part
    of a NaN does not affect the value / payload either.)

    The condition in GCC for fsel to be available is TARGET_PPC_GFXOPT,
    corresponding to the _ARCH_PPCGR predefined macro.  fsel is available
    on all 64-bit processors supported by GCC.  A few 32-bit processors
    supported by GCC do not have TARGET_PPC_GFXOPT despite having hard
    float support.  To support those processors, integer code (similar to
    that in copysignl) is included for the !_ARCH_PPCGR case for
    powerpc32.

    Tested for powerpc32 (configurations with and without _ARCH_PPCGR) and
    powerpc64.

        [BZ #20157]
        * sysdeps/powerpc/powerpc32/fpu/s_fabsl.S (__fabsl): Use fsel to
        determine whether to negate low half if [_ARCH_PPCGR], and integer
        comparison otherwise.
        * sysdeps/powerpc/powerpc64/fpu/s_fabsl.S (__fabsl): Use fsel to
        determine whether to negate low half.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                               |    7 +++++++
 sysdeps/powerpc/powerpc32/fpu/s_fabsl.S |   21 +++++++++++++++++++--
 sysdeps/powerpc/powerpc64/fpu/s_fabsl.S |    5 ++---
 3 files changed, 28 insertions(+), 5 deletions(-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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