]> sourceware.org Git - glibc.git/commitdiff
soft-fp: Remove FP_CLEAR_EXCEPTIONS.
authorJoseph Myers <joseph@codesourcery.com>
Thu, 9 Oct 2014 00:58:42 +0000 (00:58 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Thu, 9 Oct 2014 00:58:42 +0000 (00:58 +0000)
As noted in
<https://sourceware.org/ml/libc-alpha/2013-10/msg00516.html>, the
soft-fp macro FP_CLEAR_EXCEPTIONS should not be necessary, as soft-fp
code should never set an exception and later clear it.

In fact, all four uses in glibc (for SPARC) are indeed unnecessary:
they appear in files that convert 32-bit or 64-bit integers to IEEE
binary128, an operation that can never raise any exceptions.  If this
was intended to enable the compiler to optimize away any FP_FROM_INT
code testing for exceptional cases, we now have a better way of doing
this: defining FP_NO_EXCEPTIONS before including soft-fp.h causes all
code handling exceptions to be stubbed out, and the rounding mode to
be hardwired for round-to-zero, to allow such optimizations for source
files where (a) the operation in question, for the particular types in
question, can never raise exceptions, but (b) some instances of the
operation for other types can, so the macros used in the file do
contain references to rounding or exceptions, albeit dead in that
particular file.

The uses in the Linux kernel are also unnecessary (clearing exceptions
at a point where they are already cleared).

This patch duly removes FP_CLEAR_EXCEPTIONS, making the SPARC code in
question use FP_NO_EXCEPTIONS and stop using exception-related macros.

* soft-fp/soft-fp.h (FP_CLEAR_EXCEPTIONS): Remove macro.
* sysdeps/sparc/sparc32/soft-fp/q_itoq.c: Define FP_NO_EXCEPTIONS.
(_Q_itoq): Do not use FP_DECL_EX, FP_CLEAR_EXCEPTIONS or
FP_HANDLE_EXCEPTIONS.
* sysdeps/sparc/sparc32/soft-fp/q_lltoq.c: Define FP_NO_EXCEPTIONS.
(_Q_lltoq): Do not use FP_DECL_EX, FP_CLEAR_EXCEPTIONS or
FP_HANDLE_EXCEPTIONS.
* sysdeps/sparc/sparc32/soft-fp/q_ulltoq.c: Define FP_NO_EXCEPTIONS.
(_Q_ulltoq): Do not use FP_DECL_EX, FP_CLEAR_EXCEPTIONS or
FP_HANDLE_EXCEPTIONS.
* sysdeps/sparc/sparc32/soft-fp/q_utoq.c: Define FP_NO_EXCEPTIONS.
(_Q_utoq): Do not use FP_DECL_EX, FP_CLEAR_EXCEPTIONS or
FP_HANDLE_EXCEPTIONS.

ChangeLog
soft-fp/soft-fp.h
sysdeps/sparc/sparc32/soft-fp/q_itoq.c
sysdeps/sparc/sparc32/soft-fp/q_lltoq.c
sysdeps/sparc/sparc32/soft-fp/q_ulltoq.c
sysdeps/sparc/sparc32/soft-fp/q_utoq.c

index a24865e06bff5da2966e1e3aa1632818949a8cd4..b5faff4fe7c1bc8b15764c65bbfae6e480487734 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2014-10-09  Joseph Myers  <joseph@codesourcery.com>
+
+       * soft-fp/soft-fp.h (FP_CLEAR_EXCEPTIONS): Remove macro.
+       * sysdeps/sparc/sparc32/soft-fp/q_itoq.c: Define FP_NO_EXCEPTIONS.
+       (_Q_itoq): Do not use FP_DECL_EX, FP_CLEAR_EXCEPTIONS or
+       FP_HANDLE_EXCEPTIONS.
+       * sysdeps/sparc/sparc32/soft-fp/q_lltoq.c: Define FP_NO_EXCEPTIONS.
+       (_Q_lltoq): Do not use FP_DECL_EX, FP_CLEAR_EXCEPTIONS or
+       FP_HANDLE_EXCEPTIONS.
+       * sysdeps/sparc/sparc32/soft-fp/q_ulltoq.c: Define FP_NO_EXCEPTIONS.
+       (_Q_ulltoq): Do not use FP_DECL_EX, FP_CLEAR_EXCEPTIONS or
+       FP_HANDLE_EXCEPTIONS.
+       * sysdeps/sparc/sparc32/soft-fp/q_utoq.c: Define FP_NO_EXCEPTIONS.
+       (_Q_utoq): Do not use FP_DECL_EX, FP_CLEAR_EXCEPTIONS or
+       FP_HANDLE_EXCEPTIONS.
+
 2014-10-08  Joseph Myers  <joseph@codesourcery.com>
 
        [BZ #14132]
index 5fb7358cfa9fd6461641db3767e04548cb29685d..ead9c97874939627502e288449f556c85b7d7d39 100644 (file)
 #define FP_SET_EXCEPTION(ex)                           \
   _fex |= (ex)
 
-#define FP_CLEAR_EXCEPTIONS                            \
-  _fex = 0
-
 #define FP_CUR_EXCEPTIONS                              \
   (_fex)
 
index 3640506973a0f5e02296ac378f3f94b6a7a644c8..1ebb2de58ec4c54e302c3a4280fea20ee6a11f8b 100644 (file)
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define FP_NO_EXCEPTIONS
 #include "soft-fp.h"
 #include "quad.h"
 
 long double _Q_itoq(const int a)
 {
-  FP_DECL_EX;
   FP_DECL_Q(C);
   int b = a;
   long double c;
 
   FP_FROM_INT_Q(C, b, 32, unsigned int);
   FP_PACK_RAW_Q(c, C);
-  FP_CLEAR_EXCEPTIONS;
-  FP_HANDLE_EXCEPTIONS;
   return c;
 }
index 52b27121619bfdf1904cf7e0d100b352753e6912..b60d26dbcef55e7189c6c25146697c3e6a2b9cd5 100644 (file)
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define FP_NO_EXCEPTIONS
 #include "soft-fp.h"
 #include "quad.h"
 
 long double _Q_lltoq(const long long a)
 {
-  FP_DECL_EX;
   FP_DECL_Q(C);
   long double c;
   long long b = a;
 
   FP_FROM_INT_Q(C, b, 64, unsigned long long);
   FP_PACK_RAW_Q(c, C);
-  FP_CLEAR_EXCEPTIONS;
-  FP_HANDLE_EXCEPTIONS;
   return c;
 }
index 7512557f9a6f9790c1c0801f9bd94c21a348a126..524fcb945ba4232aed16a9b76a813d276f17ee75 100644 (file)
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define FP_NO_EXCEPTIONS
 #include "soft-fp.h"
 #include "quad.h"
 
 long double _Q_ulltoq(const unsigned long long a)
 {
-  FP_DECL_EX;
   FP_DECL_Q(C);
   long double c;
   unsigned long long b = a;
 
   FP_FROM_INT_Q(C, b, 64, unsigned long long);
   FP_PACK_RAW_Q(c, C);
-  FP_CLEAR_EXCEPTIONS;
-  FP_HANDLE_EXCEPTIONS;
   return c;
 }
index 0fb645c5de0b8f3418e954495b62fdc02ea555da..0ba823ed035e791228996335067544dd4df2f695 100644 (file)
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define FP_NO_EXCEPTIONS
 #include "soft-fp.h"
 #include "quad.h"
 
 long double _Q_utoq(const unsigned int a)
 {
-  FP_DECL_EX;
   FP_DECL_Q(C);
   long double c;
   unsigned int b = a;
 
   FP_FROM_INT_Q(C, b, 32, unsigned int);
   FP_PACK_RAW_Q(c, C);
-  FP_CLEAR_EXCEPTIONS;
-  FP_HANDLE_EXCEPTIONS;
   return c;
 }
This page took 0.113598 seconds and 5 git commands to generate.