From patchwork Tue Dec 15 14:13:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 1416460 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=sourceware.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=K1mlQ8xH; dkim-atps=neutral Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CwKyG2N2qz9sRK for ; Wed, 16 Dec 2020 01:14:30 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C9709386EC55; Tue, 15 Dec 2020 14:14:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C9709386EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1608041659; bh=lY9vcZi83BdsYLNdefReifjq9975KYkEbE+J4C6DjN4=; 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=K1mlQ8xHrTgTjp6HNs/6tS6QwofkjBBAHM+NnmzIQhZPfriHYqIZu+dnK2dhfcvpZ Sz2dgk8s3N6/gs5hCObVQ8rrbMVn58kpv4ZauC81JsbnyZmJgYMm8z0AsSDuRqRIXe XGgAMHc9wHT/NSzp6Yt/8NELX3jriDNjoNzdLg6Y= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from hamster.birch.relay.mailchannels.net (hamster.birch.relay.mailchannels.net [23.83.209.80]) by sourceware.org (Postfix) with ESMTPS id 8F9F6386EC4F for ; Tue, 15 Dec 2020 14:14:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8F9F6386EC4F 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 00D51122A6A; Tue, 15 Dec 2020 14:14:15 +0000 (UTC) Received: from pdx1-sub0-mail-a35.g.dreamhost.com (100-96-87-21.trex.outbound.svc.cluster.local [100.96.87.21]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 81F56122FFB; Tue, 15 Dec 2020 14:14:14 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a35.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); Tue, 15 Dec 2020 14:14:14 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Little-Harmony: 600dd64b09ac053e_1608041654785_3829548252 X-MC-Loop-Signature: 1608041654785:891526289 X-MC-Ingress-Time: 1608041654785 Received: from pdx1-sub0-mail-a35.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a35.g.dreamhost.com (Postfix) with ESMTP id 36E887E63B; Tue, 15 Dec 2020 06:14:14 -0800 (PST) Received: from rhbox.redhat.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-a35.g.dreamhost.com (Postfix) with ESMTPSA id 65EF87F4E0; Tue, 15 Dec 2020 06:14:12 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a35 To: libc-alpha@sourceware.org Subject: [PATCH 4/5] x86 long double: Consider pseudo numbers as signaling Date: Tue, 15 Dec 2020 19:43:38 +0530 Message-Id: <20201215141339.2684384-5-siddhesh@sourceware.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201215141339.2684384-1-siddhesh@sourceware.org> References: <20201215141339.2684384-1-siddhesh@sourceware.org> MIME-Version: 1.0 X-Spam-Status: No, score=-9.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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" Implement a separate x86 version of issignalingl that returns true for pseudo-normal numbers. Also drop comment from the generic version of s_issignalingl since it is no longer true or relevant. --- sysdeps/ieee754/ldbl-96/s_issignalingl.c | 2 -- sysdeps/x86/fpu/s_issignalingl.c | 39 ++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 sysdeps/x86/fpu/s_issignalingl.c diff --git a/sysdeps/ieee754/ldbl-96/s_issignalingl.c b/sysdeps/ieee754/ldbl-96/s_issignalingl.c index ec542ad468..2aa0ffae0e 100644 --- a/sysdeps/ieee754/ldbl-96/s_issignalingl.c +++ b/sysdeps/ieee754/ldbl-96/s_issignalingl.c @@ -34,8 +34,6 @@ __issignalingl (long double x) hxi ^= 0x40000000; /* If lxi != 0, then set any suitable bit of the significand in hxi. */ hxi |= (lxi | -lxi) >> 31; - /* We do not recognize a pseudo NaN as sNaN; they're invalid on 80387 and - later. */ /* We have to compare for greater (instead of greater or equal), because x's significand being all-zero designates infinity not NaN. */ return ((exi & 0x7fff) == 0x7fff) && (hxi > 0xc0000000); diff --git a/sysdeps/x86/fpu/s_issignalingl.c b/sysdeps/x86/fpu/s_issignalingl.c new file mode 100644 index 0000000000..df273b881d --- /dev/null +++ b/sysdeps/x86/fpu/s_issignalingl.c @@ -0,0 +1,39 @@ +/* Test for signaling NaN - x86 version. + Copyright (C) 2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include "sysdeps/x86/fpu/isnanl_common.h" + +int +__issignalingl (long double x) +{ + uint32_t exi, hxi, lxi, nan, pn; + GET_LDOUBLE_WORDS (exi, hxi, lxi, x); +#if HIGH_ORDER_BIT_IS_SET_FOR_SNAN +# error not implemented +#else + nan = x86_isnanl (exi, hxi, lxi); + pn = (~hxi & 0x80000000) >> 31; + hxi = (~hxi & 0x40000000) >> 30; + + return nan & (pn | hxi); +#endif +} +libm_hidden_def (__issignalingl)