Patchwork [12/28] math: Use wordsize-64 version for isnan

login
register
mail settings
Submitter Gabriel F. T. Gomes
Date June 5, 2019, 10:45 p.m.
Message ID <20190605194557.1b6d97f8@tereshkova.br.ibm.com>
Download mbox | patch
Permalink /patch/33035/
State New
Headers show

Comments

Gabriel F. T. Gomes - June 5, 2019, 10:45 p.m.
On Fri, Mar 29 2019, Adhemerval Zanella wrote:
> 
>   - The resulting binary difference on 32 bits architecture is minimum
>     for the non hotspot symbol.

I don't actually understand what the impact on 32-bits platforms would
be, so I can't comment on that, but, if this patch turns out to be
problematic for 32-bits, we could patch sysdeps/ieee754/ldbl-opt files
to be mindful of __WORDSIZE and selectively include files from
sysdeps/ieee754/dbl-64 or sysdeps/ieee754/dbl-64/wordsize-64 (see
attached patch for an explanation of what I mean).

My point in raising this is that the subsequent patch [1] benefits from
this current patch (or, alternatively, from the attached patch, since
they have the same outcame, as expected).  So, if this patch gets
objections we could go with the alternative.

[1] https://sourceware.org/ml/libc-alpha/2019-03/msg00674.html

Patch

diff --git a/sysdeps/ieee754/ldbl-opt/s_finite.c b/sysdeps/ieee754/ldbl-opt/s_finite.c
index 7d3ab0068d..85ad5e625a 100644
--- a/sysdeps/ieee754/ldbl-opt/s_finite.c
+++ b/sysdeps/ieee754/ldbl-opt/s_finite.c
@@ -1,5 +1,10 @@ 
+#include <limits.h>
 #include <math_ldbl_opt.h>
+#if __WORDSIZE == 64
+#include <sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c>
+#else
 #include <sysdeps/ieee754/dbl-64/s_finite.c>
+#endif
 weak_alias (__finite, ___finite)
 #if IS_IN (libm)
 # if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
diff --git a/sysdeps/ieee754/ldbl-opt/s_isinf.c b/sysdeps/ieee754/ldbl-opt/s_isinf.c
index 1f760a0320..da5dc01601 100644
--- a/sysdeps/ieee754/ldbl-opt/s_isinf.c
+++ b/sysdeps/ieee754/ldbl-opt/s_isinf.c
@@ -1,5 +1,10 @@ 
+#include <limits.h>
 #include <math_ldbl_opt.h>
+#if __WORDSIZE == 64
+#include <sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c>
+#else
 #include <sysdeps/ieee754/dbl-64/s_isinf.c>
+#endif
 #if !IS_IN (libm)
 # if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
 compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0);
diff --git a/sysdeps/ieee754/ldbl-opt/s_isnan.c b/sysdeps/ieee754/ldbl-opt/s_isnan.c
index 33f57f1955..99ee75ce34 100644
--- a/sysdeps/ieee754/ldbl-opt/s_isnan.c
+++ b/sysdeps/ieee754/ldbl-opt/s_isnan.c
@@ -1,5 +1,10 @@ 
+#include <limits.h>
 #include <math_ldbl_opt.h>
+#if __WORDSIZE == 64
+#include <sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c>
+#else
 #include <sysdeps/ieee754/dbl-64/s_isnan.c>
+#endif
 #if !IS_IN (libm)
 # if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
 compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);