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/19228] [powerpc] nearbyint wrongly clears "inexact", leaves traps disabled


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

--- 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  71d1b0166b4ace0d804af2993b3815758b852efc (commit)
      from  fe534fe8980fa214c410e3661a4216e781073353 (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=71d1b0166b4ace0d804af2993b3815758b852efc

commit 71d1b0166b4ace0d804af2993b3815758b852efc
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Wed Nov 11 00:06:09 2015 +0000

    Fix powerpc nearbyint wrongly clearing "inexact" and leaving traps disabled
(bug 19228).

    Similar to bug 15491 recently fixed for x86_64 / x86, the powerpc
    (both powerpc32 and powerpc64) hard-float implementations of
    nearbyintf and nearbyint wrongly clear an "inexact" exception that was
    raised before the function was called; this shows up as failure of the
    test math/test-nearbyint-except added when that bug was fixed.  They
    also wrongly leave traps on "inexact" disabled if they were enabled
    before the function was called.

    This patch fixes the bugs similar to how the x86 bug was fixed: saving
    and restoring the whole floating-point state, both to restore the
    original "inexact" flag state and to restore the original state of
    whether traps on "inexact" were enabled.  Because there's a convenient
    point in the powerpc implementations to save state after any sNaN
    arguments will have raised "invalid" but before "inexact" traps need
    to be disabled, no special handling for "invalid" is needed as in the
    x86 version.

    Tested for powerpc64 and powerpc32, where it fixes the
    math/test-nearbyint-except failure as well as fixing the new test
    math/test-nearbyint-except-2 added by this patch.  Also tested for
    x86_64 and x86 that the new test passes.

    If powerpc experts see a more efficient way of doing this
    (e.g. instruction positioning that's better for pipelines on typical
    processors) then of course followups optimizing the fix are welcome.

        [BZ #19228]
        * sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S (__nearbyint): Save
        and restore full floating-point state.
        * sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S (__nearbyintf):
        Likewise.
        * sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S (__nearbyint):
        Likewise.
        * sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S (__nearbyintf):
        Likewise.
        * math/test-nearbyint-except-2.c: New file.
        * math/Makefile (tests): Add test-nearbyint-except-2.

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

Summary of changes:
 ChangeLog                                          |   14 +++++++
 math/Makefile                                      |    3 +-
 ...earbyint-except.c => test-nearbyint-except-2.c} |   38 +++++++------------
 sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S        |    6 ++-
 sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S       |    6 ++-
 sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S        |    6 ++-
 sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S       |    6 ++-
 7 files changed, 46 insertions(+), 33 deletions(-)
 copy math/{test-nearbyint-except.c => test-nearbyint-except-2.c} (64%)

-- 
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]