From patchwork Wed Dec 23 11:56:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 41533 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A8139389201D; Wed, 23 Dec 2020 11:56:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A8139389201D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1608724590; bh=pBjUPtAv4HxgPiI5Sok39wHxIpJH/zR90qllXto9bSg=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=YU9KEri6Jd0R1iGj0JCWPS9bdY0ehKUHkx1BIdLTS0veMyys/wpsCIbks17i9JhzU Hf6LY7WCuIIFPr18ccXx/pUlB2CwDWxgn49filRHd29O3Z7ocLF5sKhtT+o3Oze2V8 HMM8k48yPsXzZrHTeI0BZqXnkPjhq3fgFqnq9pCs= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from donkey.elm.relay.mailchannels.net (donkey.elm.relay.mailchannels.net [23.83.212.49]) by sourceware.org (Postfix) with ESMTPS id 7B58B389201A for ; Wed, 23 Dec 2020 11:56:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7B58B389201A X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 1D51F321973; Wed, 23 Dec 2020 11:56:26 +0000 (UTC) Received: from pdx1-sub0-mail-a1.g.dreamhost.com (100-105-161-17.trex.outbound.svc.cluster.local [100.105.161.17]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 8B7783218F0; Wed, 23 Dec 2020 11:56:25 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a1.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.11); Wed, 23 Dec 2020 11:56:26 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Suffer-Obese: 566168023aca5d39_1608724585835_2940522322 X-MC-Loop-Signature: 1608724585835:3445465596 X-MC-Ingress-Time: 1608724585834 Received: from pdx1-sub0-mail-a1.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a1.g.dreamhost.com (Postfix) with ESMTP id 4E2907F0A4; Wed, 23 Dec 2020 03:56:25 -0800 (PST) Received: from rhbox.intra.reserved-bit.com (unknown [1.186.101.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a1.g.dreamhost.com (Postfix) with ESMTPSA id E8A137F0A6; Wed, 23 Dec 2020 03:56:22 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a1 To: libc-alpha@sourceware.org Subject: [PATCH v2 3/5] Partially revert 681900d29683722b1cb0a8e565a0585846ec5a61 Date: Wed, 23 Dec 2020 17:26:00 +0530 Message-Id: <20201223115602.3472627-4-siddhesh@sourceware.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201223115602.3472627-1-siddhesh@sourceware.org> References: <20201223115602.3472627-1-siddhesh@sourceware.org> MIME-Version: 1.0 X-Spam-Status: No, score=-8.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_NUMSUBJECT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Siddhesh Poyarekar via Libc-alpha From: Siddhesh Poyarekar Reply-To: Siddhesh Poyarekar Cc: fweimer@redhat.com, joseph@codesourcery.com Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Do not attempt to fix the significand top bit in long double input received in printf. The code should never reach here because isnan should now detect unnormals as NaN. This is already a NOP for glibc since it uses the gcc __builtin_isnan, which detects unnormals as NaN. --- sysdeps/x86/ldbl2mpn.c | 8 -------- sysdeps/x86/tst-ldbl-nonnormal-printf.c | 5 +---- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/sysdeps/x86/ldbl2mpn.c b/sysdeps/x86/ldbl2mpn.c index 23afedfb67..ec8464eef7 100644 --- a/sysdeps/x86/ldbl2mpn.c +++ b/sysdeps/x86/ldbl2mpn.c @@ -115,14 +115,6 @@ __mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size, && res_ptr[N - 1] == 0) /* Pseudo zero. */ *expt = 0; - else - /* Unlike other floating point formats, the most significant bit - is explicit and expected to be set for normal numbers. Set it - in case it is cleared in the input. Otherwise, callers will - not be able to produce the expected multi-precision integer - layout by shifting. */ - res_ptr[N - 1] |= (mp_limb_t) 1 << (LDBL_MANT_DIG - 1 - - ((N - 1) * BITS_PER_MP_LIMB)); return N; } diff --git a/sysdeps/x86/tst-ldbl-nonnormal-printf.c b/sysdeps/x86/tst-ldbl-nonnormal-printf.c index 54381ece0b..2b513960a7 100644 --- a/sysdeps/x86/tst-ldbl-nonnormal-printf.c +++ b/sysdeps/x86/tst-ldbl-nonnormal-printf.c @@ -42,10 +42,7 @@ do_test (void) char buf[30]; int ret = snprintf (buf, sizeof (buf), "%Lg", value); TEST_COMPARE (ret, strlen (buf)); - if (strcmp (buf, "nan") != 0) - /* If snprintf does not recognize the non-normal number as a NaN, - it has added the missing explicit MSB. */ - TEST_COMPARE_STRING (buf, "3.02201e-4624"); + TEST_COMPARE_STRING (buf, "nan"); return 0; }