]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Simplify x86 nearbyint functions.
authorJoseph Myers <joseph@codesourcery.com>
Wed, 22 Jun 2016 15:40:30 +0000 (15:40 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Wed, 22 Jun 2016 15:40:30 +0000 (15:40 +0000)
The i386 implementations of nearbyint functions, and x86_64
nearbyintl, contain code to mask the "inexact" exception.  However,
the fnstenv instruction has the effect of masking all exceptions, so
this masking code has been redundant since fnstenv was added to those
implementations (by commit 846d9a4a3acdb4939ca7bf6aed48f9f6f26911be;
commit 71d1b0166b4ace0d804af2993b3815758b852efc added the test
math/test-nearbyint-except-2.c that verifies these functions do work
when called with "inexact" traps enabled); this patch removes the
redundant code.

Tested for x86_64 and x86.

* sysdeps/i386/fpu/s_nearbyint.S (__nearbyint): Do not mask
"inexact" exceptions after fnstenv.
* sysdeps/i386/fpu/s_nearbyintf.S (__nearbyintf): Likewise.
* sysdeps/i386/fpu/s_nearbyintl.S (__nearbyintl): Likewise.
* sysdeps/x86_64/fpu/s_nearbyintl.S (__nearbyintl): Likewise.

ChangeLog
sysdeps/i386/fpu/s_nearbyint.S
sysdeps/i386/fpu/s_nearbyintf.S
sysdeps/i386/fpu/s_nearbyintl.S
sysdeps/x86_64/fpu/s_nearbyintl.S

index 75722e1ec70931cd1f812f826a7e7611b94ea955..0328dda5eae02a7c61ac2e4889c976b3eeb40528 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2016-06-22  Joseph Myers  <joseph@codesourcery.com>
+
+       * sysdeps/i386/fpu/s_nearbyint.S (__nearbyint): Do not mask
+       "inexact" exceptions after fnstenv.
+       * sysdeps/i386/fpu/s_nearbyintf.S (__nearbyintf): Likewise.
+       * sysdeps/i386/fpu/s_nearbyintl.S (__nearbyintl): Likewise.
+       * sysdeps/x86_64/fpu/s_nearbyintl.S (__nearbyintl): Likewise.
+
 2015-06-22  Zack Weinberg  <zackw@panix.com>
 
        * sysdeps/generic/bits/hwcap.h: Moved to ...
index 8da8ae9792708f4e640f0b181ca8f440b320d973..f7b79b6ff22cb19532054311c951ff1843bcc88a 100644 (file)
@@ -11,10 +11,6 @@ ENTRY(__nearbyint)
        subl    $32, %esp
        cfi_adjust_cfa_offset (32)
        fnstenv 4(%esp)
-       movl    4(%esp), %eax
-       orl     $0x20, %eax
-       movl    %eax, (%esp)
-       fldcw   (%esp)
        frndint
        fldenv  4(%esp)
        addl    $32, %esp
index 0c51f723643713cf9ad5aa1ac0bf8ba389b811ef..92df2f87b346278f6e3e1917f8ed0ae1347c0d5a 100644 (file)
@@ -11,10 +11,6 @@ ENTRY(__nearbyintf)
        subl    $32, %esp
        cfi_adjust_cfa_offset (32)
        fnstenv 4(%esp)
-       movl    4(%esp), %eax
-       orl     $0x20, %eax
-       movl    %eax, (%esp)
-       fldcw   (%esp)
        frndint
        fldenv  4(%esp)
        addl    $32, %esp
index b260ab5914cdc642221953dca6f99768f9070347..3b7d1e24369a89c48d19fdf4bfb738f300fac37d 100644 (file)
@@ -11,10 +11,6 @@ ENTRY(__nearbyintl)
        subl    $32, %esp
        cfi_adjust_cfa_offset (32)
        fnstenv 4(%esp)
-       movl    4(%esp), %eax
-       orl     $0x20, %eax
-       movl    %eax, (%esp)
-       fldcw   (%esp)
        frndint
        fnstsw
        andl    $0x1, %eax
index 76d41bdd522e71303ee80ebabf5dd9bde2dc7c93..31b21a5037a9b6e0f74e8a88a5576254bda8fabf 100644 (file)
@@ -9,10 +9,6 @@
 ENTRY(__nearbyintl)
        fldt    8(%rsp)
        fnstenv -28(%rsp)
-       movl    -28(%rsp), %eax
-       orl     $0x20, %eax
-       movl    %eax, -32(%rsp)
-       fldcw   -32(%rsp)
        frndint
        fnstsw
        andl    $0x1, %eax