]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Move math_narrow_eval to separate math-narrow-eval.h.
authorJoseph Myers <joseph@codesourcery.com>
Wed, 9 May 2018 00:15:10 +0000 (00:15 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Wed, 9 May 2018 00:15:10 +0000 (00:15 +0000)
This patch continues cleaning up the math_private.h header, which
contains lots of different definitions many of which are only needed
by a limited subset of files using that header (and some of which are
overridden by architectures that only want to override selected parts
of the header), by moving the math_narrow_eval macro out to a separate
math-narrow-eval.h header, only included by those files that need it.
That header is placed in include/ (since it's used in stdlib/, not
just files built in math/, but no sysdeps variants are needed at
present).

Tested for x86_64, and with build-many-glibcs.py.  (Installed stripped
shared libraries change because of line numbers in assertions in
strtod_l.c.)

* include/math-narrow-eval.h: New file.  Contents moved from ....
* sysdeps/generic/math_private.h: ... here.
(math_narrow_eval): Remove macro.  Moved to math-narrow-eval.h.
[FLT_EVAL_METHOD != 0] (excess_precision): Likewise.
* math/s_fdim_template.c: Include <math-narrow-eval.h>.
* stdlib/strtod_l.c: Likewise.
* sysdeps/i386/fpu/s_f32xaddf64.c: Likewise.
* sysdeps/i386/fpu/s_f32xsubf64.c: Likewise.
* sysdeps/i386/fpu/s_fdim.c: Likewise.
* sysdeps/ieee754/dbl-64/e_cosh.c: Likewise.
* sysdeps/ieee754/dbl-64/e_gamma_r.c: Likewise.
* sysdeps/ieee754/dbl-64/e_j1.c: Likewise.
* sysdeps/ieee754/dbl-64/e_jn.c: Likewise.
* sysdeps/ieee754/dbl-64/e_lgamma_r.c: Likewise.
* sysdeps/ieee754/dbl-64/e_sinh.c: Likewise.
* sysdeps/ieee754/dbl-64/gamma_productf.c: Likewise.
* sysdeps/ieee754/dbl-64/k_rem_pio2.c: Likewise.
* sysdeps/ieee754/dbl-64/lgamma_neg.c: Likewise.
* sysdeps/ieee754/dbl-64/s_erf.c: Likewise.
* sysdeps/ieee754/dbl-64/s_llrint.c: Likewise.
* sysdeps/ieee754/dbl-64/s_lrint.c: Likewise.
* sysdeps/ieee754/flt-32/e_coshf.c: Likewise.
* sysdeps/ieee754/flt-32/e_exp2f.c: Likewise.
* sysdeps/ieee754/flt-32/e_expf.c: Likewise.
* sysdeps/ieee754/flt-32/e_gammaf_r.c: Likewise.
* sysdeps/ieee754/flt-32/e_j1f.c: Likewise.
* sysdeps/ieee754/flt-32/e_jnf.c: Likewise.
* sysdeps/ieee754/flt-32/e_lgammaf_r.c: Likewise.
* sysdeps/ieee754/flt-32/e_sinhf.c: Likewise.
* sysdeps/ieee754/flt-32/k_rem_pio2f.c: Likewise.
* sysdeps/ieee754/flt-32/lgamma_negf.c: Likewise.
* sysdeps/ieee754/flt-32/s_erff.c: Likewise.
* sysdeps/ieee754/flt-32/s_llrintf.c: Likewise.
* sysdeps/ieee754/flt-32/s_lrintf.c: Likewise.
* sysdeps/ieee754/ldbl-96/gamma_product.c: Likewise.

34 files changed:
ChangeLog
include/math-narrow-eval.h [new file with mode: 0644]
math/s_fdim_template.c
stdlib/strtod_l.c
sysdeps/generic/math_private.h
sysdeps/i386/fpu/s_f32xaddf64.c
sysdeps/i386/fpu/s_f32xsubf64.c
sysdeps/i386/fpu/s_fdim.c
sysdeps/ieee754/dbl-64/e_cosh.c
sysdeps/ieee754/dbl-64/e_gamma_r.c
sysdeps/ieee754/dbl-64/e_j1.c
sysdeps/ieee754/dbl-64/e_jn.c
sysdeps/ieee754/dbl-64/e_lgamma_r.c
sysdeps/ieee754/dbl-64/e_sinh.c
sysdeps/ieee754/dbl-64/gamma_productf.c
sysdeps/ieee754/dbl-64/k_rem_pio2.c
sysdeps/ieee754/dbl-64/lgamma_neg.c
sysdeps/ieee754/dbl-64/s_erf.c
sysdeps/ieee754/dbl-64/s_llrint.c
sysdeps/ieee754/dbl-64/s_lrint.c
sysdeps/ieee754/flt-32/e_coshf.c
sysdeps/ieee754/flt-32/e_exp2f.c
sysdeps/ieee754/flt-32/e_expf.c
sysdeps/ieee754/flt-32/e_gammaf_r.c
sysdeps/ieee754/flt-32/e_j1f.c
sysdeps/ieee754/flt-32/e_jnf.c
sysdeps/ieee754/flt-32/e_lgammaf_r.c
sysdeps/ieee754/flt-32/e_sinhf.c
sysdeps/ieee754/flt-32/k_rem_pio2f.c
sysdeps/ieee754/flt-32/lgamma_negf.c
sysdeps/ieee754/flt-32/s_erff.c
sysdeps/ieee754/flt-32/s_llrintf.c
sysdeps/ieee754/flt-32/s_lrintf.c
sysdeps/ieee754/ldbl-96/gamma_product.c

index 6b8857bf7f2769aed78ad1bfecc096db5d792beb..02528b6eb01cd46b145ae79f4b61c60a24eebc7e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,41 @@
+2018-05-09  Joseph Myers  <joseph@codesourcery.com>
+
+       * include/math-narrow-eval.h: New file.  Contents moved from ....
+       * sysdeps/generic/math_private.h: ... here.
+       (math_narrow_eval): Remove macro.  Moved to math-narrow-eval.h.
+       [FLT_EVAL_METHOD != 0] (excess_precision): Likewise.
+       * math/s_fdim_template.c: Include <math-narrow-eval.h>.
+       * stdlib/strtod_l.c: Likewise.
+       * sysdeps/i386/fpu/s_f32xaddf64.c: Likewise.
+       * sysdeps/i386/fpu/s_f32xsubf64.c: Likewise.
+       * sysdeps/i386/fpu/s_fdim.c: Likewise.
+       * sysdeps/ieee754/dbl-64/e_cosh.c: Likewise.
+       * sysdeps/ieee754/dbl-64/e_gamma_r.c: Likewise.
+       * sysdeps/ieee754/dbl-64/e_j1.c: Likewise.
+       * sysdeps/ieee754/dbl-64/e_jn.c: Likewise.
+       * sysdeps/ieee754/dbl-64/e_lgamma_r.c: Likewise.
+       * sysdeps/ieee754/dbl-64/e_sinh.c: Likewise.
+       * sysdeps/ieee754/dbl-64/gamma_productf.c: Likewise.
+       * sysdeps/ieee754/dbl-64/k_rem_pio2.c: Likewise.
+       * sysdeps/ieee754/dbl-64/lgamma_neg.c: Likewise.
+       * sysdeps/ieee754/dbl-64/s_erf.c: Likewise.
+       * sysdeps/ieee754/dbl-64/s_llrint.c: Likewise.
+       * sysdeps/ieee754/dbl-64/s_lrint.c: Likewise.
+       * sysdeps/ieee754/flt-32/e_coshf.c: Likewise.
+       * sysdeps/ieee754/flt-32/e_exp2f.c: Likewise.
+       * sysdeps/ieee754/flt-32/e_expf.c: Likewise.
+       * sysdeps/ieee754/flt-32/e_gammaf_r.c: Likewise.
+       * sysdeps/ieee754/flt-32/e_j1f.c: Likewise.
+       * sysdeps/ieee754/flt-32/e_jnf.c: Likewise.
+       * sysdeps/ieee754/flt-32/e_lgammaf_r.c: Likewise.
+       * sysdeps/ieee754/flt-32/e_sinhf.c: Likewise.
+       * sysdeps/ieee754/flt-32/k_rem_pio2f.c: Likewise.
+       * sysdeps/ieee754/flt-32/lgamma_negf.c: Likewise.
+       * sysdeps/ieee754/flt-32/s_erff.c: Likewise.
+       * sysdeps/ieee754/flt-32/s_llrintf.c: Likewise.
+       * sysdeps/ieee754/flt-32/s_lrintf.c: Likewise.
+       * sysdeps/ieee754/ldbl-96/gamma_product.c: Likewise.
+
 2018-05-08  Andreas Schwab  <schwab@suse.de>
 
        * sysdeps/nptl/internaltypes.h: Fix comment.
diff --git a/include/math-narrow-eval.h b/include/math-narrow-eval.h
new file mode 100644 (file)
index 0000000..4361aa0
--- /dev/null
@@ -0,0 +1,47 @@
+/* Narrow floating-point values to their semantic type.
+   Copyright (C) 2015-2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _MATH_NARROW_EVAL_H
+#define _MATH_NARROW_EVAL_H    1
+
+#include <float.h>
+
+/* math_narrow_eval reduces its floating-point argument to the range
+   and precision of its semantic type.  (The original evaluation may
+   still occur with excess range and precision, so the result may be
+   affected by double rounding.)  */
+#if FLT_EVAL_METHOD == 0
+# define math_narrow_eval(x) (x)
+#else
+# if FLT_EVAL_METHOD == 1
+#  define excess_precision(type) __builtin_types_compatible_p (type, float)
+# else
+#  define excess_precision(type) (__builtin_types_compatible_p (type, float) \
+                                 || __builtin_types_compatible_p (type, \
+                                                                  double))
+# endif
+# define math_narrow_eval(x)                                   \
+  ({                                                           \
+    __typeof (x) math_narrow_eval_tmp = (x);                   \
+    if (excess_precision (__typeof (math_narrow_eval_tmp)))    \
+      __asm__ ("" : "+m" (math_narrow_eval_tmp));              \
+    math_narrow_eval_tmp;                                      \
+   })
+#endif
+
+#endif /* math-narrow-eval.h */
index d10d2beeb39f490412d563e529b2db4a682f5fe8..c8fa71f92bdb5802a8e07d135730aa728647d588 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <errno.h>
 #include <math.h>
+#include <math-narrow-eval.h>
 #include <math_private.h>
 
 FLOAT
index 98e0b46d58a5b7acc6c6ee1d5247b2c935d09eb6..09a40ad173643f202521708a112b567aa7446161 100644 (file)
@@ -66,6 +66,7 @@ extern double ____strtod_l_internal (const char *, char **, int, locale_t);
 #include <float.h>
 #include "../locale/localeinfo.h"
 #include <math.h>
+#include <math-narrow-eval.h>
 #include <math_private.h>
 #include <stdlib.h>
 #include <string.h>
index ecb37394fb1d3cd3fb19a2f822e7e7f564814ffe..703f506ea0d6a4ce28f87d35caa74fe8d43d6e2e 100644 (file)
@@ -270,29 +270,6 @@ extern void __docos (double __x, double __dx, double __v[]);
 ({ __typeof (x) __x = (x); __asm __volatile__ ("" : : "m" (__x)); })
 #endif
 
-/* math_narrow_eval reduces its floating-point argument to the range
-   and precision of its semantic type.  (The original evaluation may
-   still occur with excess range and precision, so the result may be
-   affected by double rounding.)  */
-#if FLT_EVAL_METHOD == 0
-# define math_narrow_eval(x) (x)
-#else
-# if FLT_EVAL_METHOD == 1
-#  define excess_precision(type) __builtin_types_compatible_p (type, float)
-# else
-#  define excess_precision(type) (__builtin_types_compatible_p (type, float) \
-                                 || __builtin_types_compatible_p (type, \
-                                                                  double))
-# endif
-# define math_narrow_eval(x)                                   \
-  ({                                                           \
-    __typeof (x) math_narrow_eval_tmp = (x);                   \
-    if (excess_precision (__typeof (math_narrow_eval_tmp)))    \
-      __asm__ ("" : "+m" (math_narrow_eval_tmp));              \
-    math_narrow_eval_tmp;                                      \
-   })
-#endif
-
 #define fabs_tg(x) __MATH_TG ((x), (__typeof (x)) __builtin_fabs, (x))
 
 /* These must be function-like macros because some __MATH_TG
index c622a23fe0741a9ee7a12a41b9d3966bcd28cdb5..9d5e85b409dc833f4ebcb72e6e3519eea7b46451 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <fpu_control.h>
+#include <math-narrow-eval.h>
 #include <math_private.h>
 #include <math-narrow.h>
 
index 3a7dbca27e772a9f1ed3ab445e207a8c87139688..3f41acfdc93adf71d04bfa22bfb12562ce9738ec 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <fpu_control.h>
+#include <math-narrow-eval.h>
 #include <math_private.h>
 #include <math-narrow.h>
 
index f38bba4c38266439e85d50ff10a77cdbf43d45bd..b8fefe7d18a5571f2dcefe05f63ea0d1d0d6920a 100644 (file)
@@ -19,6 +19,7 @@
 #include <errno.h>
 #include <fpu_control.h>
 #include <math.h>
+#include <math-narrow-eval.h>
 #include <math_private.h>
 #include <libm-alias-double.h>
 
index bd940c73143e93bbb2a5b6e6c51284e538ee6fe8..ae2180aa89d50341cb7554ae314d1f7805b52493 100644 (file)
@@ -32,6 +32,7 @@
  */
 
 #include <math.h>
+#include <math-narrow-eval.h>
 #include <math_private.h>
 
 static const double one = 1.0, half = 0.5, huge = 1.0e300;
index ac7fe2eb94f9752acba932560339461e25ab1ff7..a3750f9f311f47a53724fdd98f40b11f2670be67 100644 (file)
@@ -18,6 +18,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <math.h>
+#include <math-narrow-eval.h>
 #include <math_private.h>
 #include <float.h>
 
index b528998b32cde8eacb86c2c79ef5150579450f85..d0e387e1a21d497bd05dbec070e25cd84fd953df 100644 (file)
@@ -61,6 +61,7 @@
 #include <errno.h>
 #include <float.h>
 #include <math.h>
+#include <math-narrow-eval.h>
 #include <math_private.h>
 
 static double pone (double), qone (double);
index 12cc0d55d56a58f10548b1bda3ecb48037c92145..6ef0fbea1c266d7fd2f71a04913da5c49320d486 100644 (file)
@@ -39,6 +39,7 @@
 #include <errno.h>
 #include <float.h>
 #include <math.h>
+#include <math-narrow-eval.h>
 #include <math_private.h>
 
 static const double
index 93eda99662da25f38aca82a15b11d244a67335ef..17717d915f0cf7e6dfb274174f37009e2254f95e 100644 (file)
@@ -78,6 +78,7 @@
  */
 
 #include <math.h>
+#include <math-narrow-eval.h>
 #include <math_private.h>
 #include <libc-diag.h>
 
index e9371b820b5a5fe0e26993cc2b8cf8e6d7deae34..49c24fb4894d6024eb3ec47aaada04bcbcbf9139 100644 (file)
@@ -34,6 +34,7 @@ static char rcsid[] = "$NetBSD: e_sinh.c,v 1.7 1995/05/10 20:46:13 jtc Exp $";
 
 #include <float.h>
 #include <math.h>
+#include <math-narrow-eval.h>
 #include <math_private.h>
 
 static const double one = 1.0, shuge = 1.0e307;
index b93bf55227d938d7cd30f1a7e11b620bdbce8e8e..011c6ff06ea96320722fc85a056ffb01ad57ff02 100644 (file)
@@ -17,6 +17,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <math.h>
+#include <math-narrow-eval.h>
 #include <math_private.h>
 #include <float.h>
 
index 2b5add6976783d4b9a041b3fc63d96229953ed9a..820fe7787e49a4da9360dc2285778807d4d929a0 100644 (file)
@@ -131,6 +131,7 @@ static char rcsid[] = "$NetBSD: k_rem_pio2.c,v 1.7 1995/05/10 20:46:25 jtc Exp $
  */
 
 #include <math.h>
+#include <math-narrow-eval.h>
 #include <math_private.h>
 #include <libc-diag.h>
 
index 4255520648e29e48b8b1432298d922f609478c2d..5bb2f10c717c6cdaa724cecccbe1f6657cc5fc6b 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <float.h>
 #include <math.h>
+#include <math-narrow-eval.h>
 #include <math_private.h>
 
 static const double lgamma_zeros[][2] =
index 78287fd1cbeadf176604ee1425a910f7e2ecb5f7..48dfca3317694e5e3a26670c78d99643193ab2b6 100644 (file)
@@ -115,6 +115,7 @@ static char rcsid[] = "$NetBSD: s_erf.c,v 1.8 1995/05/10 20:47:05 jtc Exp $";
 #include <errno.h>
 #include <float.h>
 #include <math.h>
+#include <math-narrow-eval.h>
 #include <math_private.h>
 #include <libm-alias-double.h>
 #include <fix-int-fp-convert-zero.h>
index c6ef0556ff49d6545d8a1e4cbd87916e3734e170..8159706f901b9097285186534c73f5a693570250 100644 (file)
@@ -22,6 +22,7 @@
 #include <limits.h>
 #include <math.h>
 
+#include <math-narrow-eval.h>
 #include <math_private.h>
 #include <libm-alias-double.h>
 #include <fix-fp-int-convert-overflow.h>
index 5df117a8a0b1cad7cf0f50b085f9f9dd568015b2..0e64ae1260d9fa2411ffd81eb31340ab6b1dc788 100644 (file)
@@ -22,6 +22,7 @@
 #include <limits.h>
 #include <math.h>
 
+#include <math-narrow-eval.h>
 #include <math_private.h>
 #include <libm-alias-double.h>
 #include <fix-fp-int-convert-overflow.h>
index 7b223758e161e570f838aaa2392ce4a665b32785..a2aa83876d9364b18fe348c1cf2a424db3dd9cfe 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 #include <math.h>
+#include <math-narrow-eval.h>
 #include <math_private.h>
 
 static const float huge = 1.0e30;
index cf078fe2048b5afbbfdf1b817ea6fe1f70694eaf..7218e5d254254cc0514d43f5a94afff9f68f74a3 100644 (file)
@@ -17,6 +17,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <math.h>
+#include <math-narrow-eval.h>
 #include <stdint.h>
 #include <shlib-compat.h>
 #include <libm-alias-float.h>
index 32ce1b55b9be9dac93bc40559adfcebf2333fba6..f2238bfd74e5789179b9b59bbe7de19099e674fa 100644 (file)
@@ -22,6 +22,7 @@
 #endif
 
 #include <math.h>
+#include <math-narrow-eval.h>
 #include <stdint.h>
 #include <shlib-compat.h>
 #include <libm-alias-float.h>
index efbff02155e584fddd5ed3b2265bbe9189415a16..d640510448922e35587a228c816d12a62cb3b4fd 100644 (file)
@@ -18,6 +18,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <math.h>
+#include <math-narrow-eval.h>
 #include <math_private.h>
 #include <float.h>
 
index 95f03d15c5a6e558ab7f3e6f1b1869342c5c0b0e..8aadc4c31a9dd7541baeada6c810900c7ca94052 100644 (file)
@@ -16,6 +16,7 @@
 #include <errno.h>
 #include <float.h>
 #include <math.h>
+#include <math-narrow-eval.h>
 #include <math_private.h>
 
 static float ponef(float), qonef(float);
index 4b78ecea6c23d385f4857adf543171b928dc9428..a4414ce27ec0e46af66494f8e6d59c472d38e8b2 100644 (file)
@@ -16,6 +16,7 @@
 #include <errno.h>
 #include <float.h>
 #include <math.h>
+#include <math-narrow-eval.h>
 #include <math_private.h>
 
 static const float
index b0baad6e14a930f9bb062d7446b80003845d497e..8fdf9bb8bcbfcda1a27a548290db67e4187755b8 100644 (file)
@@ -14,6 +14,7 @@
  */
 
 #include <math.h>
+#include <math-narrow-eval.h>
 #include <math_private.h>
 #include <libc-diag.h>
 
index 6100d95c551ed3dffcb1374db2fbacf0c03dfb6a..17b3663dde7aac7d6de0a3ee123123cbcaa90754 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <float.h>
 #include <math.h>
+#include <math-narrow-eval.h>
 #include <math_private.h>
 
 static const float one = 1.0, shuge = 1.0e37;
index a8d5b216e62e41c2933c0aafc015c3ef98aabcdb..fdf2b5da2c2b5e1839603e9f2eb904a2e0d69fd9 100644 (file)
@@ -18,6 +18,7 @@ static char rcsid[] = "$NetBSD: k_rem_pio2f.c,v 1.4 1995/05/10 20:46:28 jtc Exp
 #endif
 
 #include <math.h>
+#include <math-narrow-eval.h>
 #include <math_private.h>
 #include <libc-diag.h>
 
index c60f6ca4477cb2e016bce8609ca77ab125ba022c..01edb0b8def8059d8701780bbabdcffd7f60d83d 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <float.h>
 #include <math.h>
+#include <math-narrow-eval.h>
 #include <math_private.h>
 
 static const float lgamma_zeros[][2] =
index 6eacf0f5fcd86b131da66ca5b37ad84c7800cdfc..1d00abdbf1cedb9a0e22b4a3b091e186bbf12945 100644 (file)
@@ -20,6 +20,7 @@ static char rcsid[] = "$NetBSD: s_erff.c,v 1.4 1995/05/10 20:47:07 jtc Exp $";
 #include <errno.h>
 #include <float.h>
 #include <math.h>
+#include <math-narrow-eval.h>
 #include <math_private.h>
 #include <libm-alias-float.h>
 #include <fix-int-fp-convert-zero.h>
index 974214c10d09aa2735f7be993d0ed521ac6e2a28..7c64bb2db4e95fcfeffdb030992931da68846d81 100644 (file)
@@ -22,6 +22,7 @@
 #include <limits.h>
 #include <math.h>
 
+#include <math-narrow-eval.h>
 #include <math_private.h>
 #include <libm-alias-float.h>
 #include <fix-fp-int-convert-overflow.h>
index 8bdc1ca7ce433b1488a9cc310ff4718f5c39781b..5171377a4eb388edce6c069868f122cb0f240fe1 100644 (file)
@@ -22,6 +22,7 @@
 #include <limits.h>
 #include <math.h>
 
+#include <math-narrow-eval.h>
 #include <math_private.h>
 #include <libm-alias-float.h>
 #include <fix-fp-int-convert-overflow.h>
index 9276dd57804d39fc79c4709fcd16215690d39327..f1b65e12e2635052fed33a5560a774494c633a94 100644 (file)
@@ -17,6 +17,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <math.h>
+#include <math-narrow-eval.h>
 #include <math_private.h>
 #include <float.h>