From patchwork Tue Jul 1 17:06:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 1840 Received: (qmail 25638 invoked by alias); 1 Jul 2014 17:06:50 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 25617 invoked by uid 89); 1 Jul 2014 17:06:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL, BAYES_50, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-qg0-f53.google.com X-Received: by 10.140.48.161 with SMTP id o30mr71460482qga.68.1404234405296; Tue, 01 Jul 2014 10:06:45 -0700 (PDT) From: Richard Henderson To: libc-alpha@sourceware.org Subject: [COMMITTED 2/2] alpha: Fix isnan Date: Tue, 1 Jul 2014 10:06:37 -0700 Message-Id: <1404234397-29920-2-git-send-email-rth@twiddle.net> In-Reply-To: <1404234397-29920-1-git-send-email-rth@twiddle.net> References: <1404234397-29920-1-git-send-email-rth@twiddle.net> The isunordered formulation raises SIGFPE for SNaN. --- ChangeLog | 4 ++++ sysdeps/alpha/fpu/bits/mathinline.h | 23 ----------------------- sysdeps/alpha/fpu/s_isnan.c | 4 +++- 3 files changed, 7 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 39b6b54..a079a18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2014-07-01 Richard henderson + * sysdeps/alpha/fpu/bits/mathinline.h (__isnanf): Remove. + (__isnan, __isnanl): Remove. + * sysdeps/alpha/fpu/s_isnan.c (__isnan): Use integer arithmetic. + * sysdeps/alpha/fpu/libm-test-ulps: Update. 2014-07-01 Stefan Liebler diff --git a/sysdeps/alpha/fpu/bits/mathinline.h b/sysdeps/alpha/fpu/bits/mathinline.h index 3d64b56..83f3b4a 100644 --- a/sysdeps/alpha/fpu/bits/mathinline.h +++ b/sysdeps/alpha/fpu/bits/mathinline.h @@ -120,29 +120,6 @@ __NTH (__signbitl (long double __x)) return __builtin_signbitl (__x); #endif } - -/* Test for NaN. Used in the isnan() macro. */ - -__MATH_INLINE int -__NTH (__isnanf (float __x)) -{ - return isunordered (__x, __x); -} - -__MATH_INLINE int -__NTH (__isnan (double __x)) -{ - return isunordered (__x, __x); -} - -#ifndef __NO_LONG_DOUBLE_MATH -__MATH_INLINE int -__NTH (__isnanl (long double __x)) -{ - return isunordered (__x, __x); -} -#endif - #endif /* C99 */ #endif /* __NO_MATH_INLINES */ diff --git a/sysdeps/alpha/fpu/s_isnan.c b/sysdeps/alpha/fpu/s_isnan.c index adfb4cc..d664f0c 100644 --- a/sysdeps/alpha/fpu/s_isnan.c +++ b/sysdeps/alpha/fpu/s_isnan.c @@ -31,7 +31,9 @@ int __isnan (double x) { - return isunordered (x, x); + uint64_t ix; + EXTRACT_WORDS64 (ix, x); + return ix * 2 > 0xffe0000000000000ul; } hidden_def (__isnan)