From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: libc-alpha@sourceware.org
Subject: [PATCH 12/28] math: Use wordsize-64 version for isnan
Date: Fri, 29 Mar 2019 10:35:13 -0300 [thread overview]
Message-ID: <20190329133529.22523-13-adhemerval.zanella@linaro.org> (raw)
In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org>
- math.h will use compiler builtin for gcc 4.4+ when built without
-fsignaling-nans and the builtin is expanded inline for all
supported architectures. As an example, there is no intra isnan
call on libm for the architecture I checked (x86, arm, aarch64,
and powerpc).
- The resulting binary difference on 32 bits architecture is minimum
for the non hotspot symbol.
- It helps wordsize-64 architectures that use ldbl-opt.
- It add some code simplification with reduction of duplicated
implementations.
Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).
* sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c: Move to ...
* sysdeps/ieee754/dbl-64/s_isnan.c: ... here and format code.
---
sysdeps/ieee754/dbl-64/s_isnan.c | 17 +++------
sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c | 40 --------------------
2 files changed, 6 insertions(+), 51 deletions(-)
delete mode 100644 sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c
diff --git a/sysdeps/ieee754/dbl-64/s_isnan.c b/sysdeps/ieee754/dbl-64/s_isnan.c
index 82723eeb8a..1f1535dea3 100644
--- a/sysdeps/ieee754/dbl-64/s_isnan.c
+++ b/sysdeps/ieee754/dbl-64/s_isnan.c
@@ -10,10 +10,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: s_isnan.c,v 1.8 1995/05/10 20:47:36 jtc Exp $";
-#endif
-
/*
* isnan(x) returns 1 is x is nan, else 0;
* no branching!
@@ -23,17 +19,16 @@ static char rcsid[] = "$NetBSD: s_isnan.c,v 1.8 1995/05/10 20:47:36 jtc Exp $";
#include <math_private.h>
#include <ldbl-classify-compat.h>
#include <shlib-compat.h>
+#include <stdint.h>
-#undef __isnan
int
__isnan (double x)
{
- int32_t hx, lx;
- EXTRACT_WORDS (hx, lx, x);
- hx &= 0x7fffffff;
- hx |= (uint32_t) (lx | (-lx)) >> 31;
- hx = 0x7ff00000 - hx;
- return (int) (((uint32_t) hx) >> 31);
+ int64_t hx;
+ EXTRACT_WORDS64 (hx, x);
+ hx &= UINT64_C (0x7fffffffffffffff);
+ hx = UINT64_C (0x7ff0000000000000) - hx;
+ return (int)(((uint64_t)hx)>>63);
}
hidden_def (__isnan)
weak_alias (__isnan, isnan)
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c
deleted file mode 100644
index cd805d157b..0000000000
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* @(#)s_isnan.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * isnan(x) returns 1 is x is nan, else 0;
- * no branching!
- */
-
-#include <math.h>
-#include <math_private.h>
-#include <ldbl-classify-compat.h>
-#include <shlib-compat.h>
-#include <stdint.h>
-
-#undef __isnan
-int __isnan(double x)
-{
- int64_t hx;
- EXTRACT_WORDS64(hx,x);
- hx &= UINT64_C(0x7fffffffffffffff);
- hx = UINT64_C(0x7ff0000000000000) - hx;
- return (int)(((uint64_t)hx)>>63);
-}
-hidden_def (__isnan)
-weak_alias (__isnan, isnan)
-#ifdef NO_LONG_DOUBLE
-# if LDBL_CLASSIFY_COMPAT && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
-compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
-# endif
-weak_alias (__isnan, isnanl)
-#endif
--
2.17.1
next prev parent reply other threads:[~2019-03-29 13:38 UTC|newest]
Thread overview: 89+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-29 13:35 [PATCH 00/28] powerpc floating-point optimization refactor Adhemerval Zanella
2019-03-29 13:35 ` [PATCH 01/28] powerpc: Use generic fabs{f} implementations Adhemerval Zanella
2019-04-01 20:04 ` Joseph Myers
2019-04-03 1:04 ` Adhemerval Zanella
2019-04-15 20:23 ` Gabriel F. T. Gomes
2019-04-15 21:32 ` Tulio Magno Quites Machado Filho
2019-04-17 17:08 ` Adhemerval Zanella
2019-03-29 13:35 ` [PATCH 02/28] powerpc: fma using builtins Adhemerval Zanella
2019-04-01 20:05 ` Joseph Myers
2019-04-03 1:06 ` Adhemerval Zanella
2019-04-15 21:44 ` Gabriel F. T. Gomes
2019-04-17 21:10 ` Joseph Myers
2019-04-17 21:28 ` Adhemerval Zanella
2019-03-29 13:35 ` [PATCH 03/28] powerpc: Remove power4 mpa optimization Adhemerval Zanella
2019-04-24 21:51 ` Gabriel F. T. Gomes
2019-04-25 12:19 ` Adhemerval Zanella
2019-03-29 13:35 ` [PATCH 04/28] powerpc: ceil/ceilf refactor Adhemerval Zanella
2019-04-25 1:56 ` Gabriel F. T. Gomes
2019-04-25 21:58 ` Adhemerval Zanella
2019-05-02 18:41 ` Gabriel F. T. Gomes
2019-05-04 21:46 ` Gabriel F. T. Gomes
2019-05-06 12:22 ` Adhemerval Zanella
2019-05-09 19:56 ` Gabriel F. T. Gomes
2019-03-29 13:35 ` [PATCH 05/28] powerpc: floor/floorf refactor Adhemerval Zanella
2019-05-03 21:44 ` Gabriel F. T. Gomes
2019-03-29 13:35 ` [PATCH 06/28] powerpc: round/roundf refactor Adhemerval Zanella
2019-05-04 1:10 ` Gabriel F. T. Gomes
2019-03-29 13:35 ` [PATCH 07/28] powerpc: trunc/truncf refactor Adhemerval Zanella
2019-05-09 20:06 ` Gabriel F. T. Gomes
2019-05-09 20:54 ` Adhemerval Zanella
2019-05-09 21:36 ` Gabriel F. T. Gomes
2019-03-29 13:35 ` [PATCH 08/28] powerpc: generic nearbyint/nearbyintf Adhemerval Zanella
2019-05-27 20:42 ` Gabriel F. T. Gomes
2019-03-29 13:35 ` [PATCH 09/28] powerpc: consolidate rint Adhemerval Zanella
2019-05-30 14:36 ` Gabriel F. T. Gomes
2019-03-29 13:35 ` [PATCH 10/28] powerpc: copysign cleanup Adhemerval Zanella
2019-05-31 14:14 ` Gabriel F. T. Gomes
2019-03-29 13:35 ` [PATCH 11/28] benchtests: Add isnan/isinf/isfinite benchmark Adhemerval Zanella
2019-06-05 22:45 ` Gabriel F. T. Gomes
2019-03-29 13:35 ` Adhemerval Zanella [this message]
2019-06-05 22:45 ` [PATCH 12/28] math: Use wordsize-64 version for isnan Gabriel F. T. Gomes
2019-03-29 13:35 ` [PATCH 13/28] powerpc: Remove optimized isnan Adhemerval Zanella
2019-06-05 22:46 ` Gabriel F. T. Gomes
2019-03-29 13:35 ` [PATCH 14/28] math: Use wordsize-64 version for isinf Adhemerval Zanella
2019-06-11 13:13 ` Gabriel F. T. Gomes
2019-06-13 8:57 ` Szabolcs Nagy
2019-06-13 9:11 ` Szabolcs Nagy
2019-03-29 13:35 ` [PATCH 15/28] powerpc: Remove optimized isinf Adhemerval Zanella
2019-06-11 13:45 ` Gabriel F. T. Gomes
2019-03-29 13:35 ` [PATCH 16/28] math: Use wordsize-64 version for finite Adhemerval Zanella
2019-06-11 16:20 ` Gabriel F. T. Gomes
2019-03-29 13:35 ` [PATCH 17/28] powerpc: Remove optimized finite Adhemerval Zanella
2019-06-11 18:08 ` Gabriel F. T. Gomes
2019-03-29 13:35 ` [PATCH 18/28] powerpc: refactor powerpc64 lrint/lrintf/llrint/llrintf Adhemerval Zanella
2019-06-13 19:30 ` Gabriel F. T. Gomes
2019-03-29 13:35 ` [PATCH 19/28] powerpc: Refactor powerpc32 lrint/lrintf/llrint/llrintf Adhemerval Zanella
2019-06-14 18:34 ` Gabriel F. T. Gomes
2019-03-29 13:35 ` [PATCH 20/28] powerpc: Refactor powerpc64 lround/lroundf/llround/llroundf Adhemerval Zanella
2019-06-13 19:30 ` Gabriel F. T. Gomes
2019-03-29 13:35 ` [PATCH 21/28] powerpc: Refactor powerpc32 lround/lroundf/llround/llroundf Adhemerval Zanella
2019-06-24 21:07 ` Gabriel F. T. Gomes
2019-06-25 18:34 ` Adhemerval Zanella
2019-06-25 18:44 ` Gabriel F. T. Gomes
2019-03-29 13:35 ` [PATCH 22/28] powerpc: Use generic e_expf Adhemerval Zanella
2019-06-26 12:59 ` Gabriel F. T. Gomes
2019-03-29 13:35 ` [PATCH 23/28] benchtests: hypot benchmark Adhemerval Zanella
2019-06-26 19:58 ` Gabriel F. T. Gomes
2019-03-29 13:35 ` [PATCH 24/28] powerpc: hypot refactor and optimization Adhemerval Zanella
2019-04-01 20:14 ` Joseph Myers
2019-04-03 1:08 ` Adhemerval Zanella
2019-06-26 19:59 ` Gabriel F. T. Gomes
2019-07-08 15:37 ` Adhemerval Zanella
2019-07-08 18:30 ` Adhemerval Zanella
2019-03-29 13:35 ` [PATCH 25/28] powerpc: Refactor modf{f} Adhemerval Zanella
2019-07-05 1:23 ` Gabriel F. T. Gomes
2019-07-08 18:30 ` Adhemerval Zanella
2019-03-29 13:35 ` [PATCH 26/28] benchtests: Add logb{f} benchmark Adhemerval Zanella
2019-07-05 1:23 ` Gabriel F. T. Gomes
2019-07-08 18:31 ` Adhemerval Zanella
2019-03-29 13:35 ` [PATCH 27/28] math: Use wordsize-64 version for s_logb Adhemerval Zanella
2019-07-05 1:23 ` Gabriel F. T. Gomes
2019-07-08 18:31 ` Adhemerval Zanella
2019-03-29 13:35 ` [PATCH 28/28] powerpc: refactor logb{f,l} Adhemerval Zanella
2019-07-05 1:24 ` Gabriel F. T. Gomes
2019-07-08 18:31 ` Adhemerval Zanella
-- strict thread matches above, loose matches on Subject: below --
2019-06-11 17:15 [PATCH 12/28] math: Use wordsize-64 version for isnan Wilco Dijkstra
2019-06-11 21:04 ` Adhemerval Zanella
2019-06-12 11:11 ` Wilco Dijkstra
2019-06-12 13:04 ` Gabriel F. T. Gomes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190329133529.22523-13-adhemerval.zanella@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).