public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: ilogbl: Make sure to return FP_ILGB0 on zero input
Date: Mon, 16 Dec 2019 09:51:00 -0000	[thread overview]
Message-ID: <20191216095111.124348.qmail@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=29ba52da95532f61e2e15694245d5f25620e34b6

commit 29ba52da95532f61e2e15694245d5f25620e34b6
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Mon Dec 16 10:50:17 2019 +0100

    Cygwin: ilogbl: Make sure to return FP_ILGB0 on zero input
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/math/ilogbl.S | 10 ++++++++++
 winsup/cygwin/release/3.1.0 |  3 +++
 2 files changed, 13 insertions(+)

diff --git a/winsup/cygwin/math/ilogbl.S b/winsup/cygwin/math/ilogbl.S
index f68082c..a4fe503 100644
--- a/winsup/cygwin/math/ilogbl.S
+++ b/winsup/cygwin/math/ilogbl.S
@@ -23,6 +23,8 @@ __MINGW_USYMBOL(ilogbl):
 	andb    %ah, %dh
 	cmpb    $0x05, %dh
 	je      1f		/* Is +-Inf, jump.  */
+	cmpb	$0x40, %dh
+	je	2f		/* Is +-Inf, jump.  */
 
 	fxtract
 	pushq	%rax
@@ -37,6 +39,9 @@ __MINGW_USYMBOL(ilogbl):
 1:	fstp	%st
 	movl	$0x7fffffff, %eax
 	ret
+2:	fstp    %st
+	movl	$0x80000001, %eax	/* FP_ILOGB0  */
+	ret
 #else
 	fldt	4(%esp)
 /* I added the following ugly construct because ilogb(+-Inf) is
@@ -48,6 +53,8 @@ __MINGW_USYMBOL(ilogbl):
 	andb    %ah, %dh
 	cmpb    $0x05, %dh
 	je      1f		/* Is +-Inf, jump.  */
+	cmpb	$0x40, %dh
+	je	2f		/* Is +-Inf, jump.  */
 
 	fxtract
 	pushl	%eax
@@ -62,4 +69,7 @@ __MINGW_USYMBOL(ilogbl):
 1:	fstp	%st
 	movl	$0x7fffffff, %eax
 	ret
+2:	fstp    %st
+	movl	$0x80000001, %eax	/* FP_ILOGB0  */
+	ret
 #endif
diff --git a/winsup/cygwin/release/3.1.0 b/winsup/cygwin/release/3.1.0
index b0e8456..681ea5d 100644
--- a/winsup/cygwin/release/3.1.0
+++ b/winsup/cygwin/release/3.1.0
@@ -108,3 +108,6 @@ Bug Fixes
 - Fix an assertion failure when /cygdrive contains an offline network
   drive.
   Addresses: https://cygwin.com/ml/cygwin/2019-12/msg00016.html
+
+- Fix return value of ilogbl for 0 input.
+  Addresses: https://cygwin.com/ml/cygwin/2019-12/msg00074.html


                 reply	other threads:[~2019-12-16  9:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191216095111.124348.qmail@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@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).