Message ID | 20221012065050.412900-4-aldyh@redhat.com |
---|---|
State | New, archived |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp2466714wrs; Tue, 11 Oct 2022 23:52:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6aM2SRMuInWDMb0QSCRq4AxyO48LhbCDDU5VC7X7wu7J+KIr8d+s6XA00eU9MkMvs5n4SI X-Received: by 2002:aa7:c98d:0:b0:45c:6451:320e with SMTP id c13-20020aa7c98d000000b0045c6451320emr7354723edt.172.1665557551935; Tue, 11 Oct 2022 23:52:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665557551; cv=none; d=google.com; s=arc-20160816; b=JnotXzcHPT4xBbZbzQnYilmPFy48Hw5TflApVVc/qW4oGh3Uufm4MvB9H30DA8qUGU gZkMcJODVR0C1lrA/bZXlOiA0MlzCqdVwYHq29lZHslSWP8qJmTSB+Ao1PqA7LOpuW5d RULkSRYk+5TvQZhlfF6caoFtJWwnK7BxXR9KdLCkiJynwawp83L4AWu0CD41eLhaECgv H7C2TdvR72NK2Xqd5d7WdVK3zrc3FmiUzjy/Yjdgr0jsMQqWddPFzVjiWDshtkf1J6/l UuevVJwozwqPUb+oh0uq3c/Rnqk4uzreZbppP+kKxIjudkJaRSmWDR/ouhOKrJZGJhmI HXrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=zec7Pw9ccaVlFzYyjy0MjTvpZdsbY7L9y0g/5haonv0=; b=nxDFrfFykjYrxHsRQLhygUhpO4O8rOFO6Kp3HQfiOXB9I+GBt66iK7lifIdf+XLwNK lAmhYUE7bo3wd/x3nartLQEzGwRhJ64LMgMWFofhzbXEq/IZ5oVIcAeLQNoQkBAMscl0 pP3e/nv/F1yjPDbOuRrBTmKnbBc0I/F2ZTo7mXLOkx3qZIILWL+o4Zy2R2uRcXsgZL8Z pe9qJyiECI73c8F/ty5IFhExjSgbROIlIGA4eve6Z13j8pa85cIippS1+icWjTovpTbv b13u+mFPZ16XewKnfkjcPMW7TjGheVsT3tY6QmEHyplHJ7ze/4UZ5NXk33N6OUhu5dRo clTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=j2hSTUg6; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id sa35-20020a1709076d2300b00783160b16a1si9018664ejc.397.2022.10.11.23.52.31 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Oct 2022 23:52:31 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=j2hSTUg6; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B2DCC383FB8F for <ouuuleilei@gmail.com>; Wed, 12 Oct 2022 06:51:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B2DCC383FB8F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665557503; bh=zec7Pw9ccaVlFzYyjy0MjTvpZdsbY7L9y0g/5haonv0=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=j2hSTUg6zTdqmSsm7yFsJKCh0+IQtUChTU41AF/5bDSDy7xdqZ0oN026TJjpy+7t1 LtKb0X2XEgbpVQ47g+/tpVKnAQF7nAb/B7+QaCZ/PNudBgP5HL9Q0ZyKl4ontYopcF ImYqNJd4TSZG8zYDBISwKmTqRN7ZfDCkyam8707c= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 8FAD3385B839 for <gcc-patches@gcc.gnu.org>; Wed, 12 Oct 2022 06:50:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8FAD3385B839 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-335-y9J7ADPXOM-wd_PTnAHzsg-1; Wed, 12 Oct 2022 02:50:56 -0400 X-MC-Unique: y9J7ADPXOM-wd_PTnAHzsg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7C0E31C051A3 for <gcc-patches@gcc.gnu.org>; Wed, 12 Oct 2022 06:50:56 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.193.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 25CF52166B2F; Wed, 12 Oct 2022 06:50:55 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.17.1/8.17.1) with ESMTPS id 29C6ostI412954 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 12 Oct 2022 08:50:54 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 29C6osct412953; Wed, 12 Oct 2022 08:50:54 +0200 To: GCC patches <gcc-patches@gcc.gnu.org> Subject: [COMMITTED] Add method to query the sign of a NAN. Date: Wed, 12 Oct 2022 08:50:49 +0200 Message-Id: <20221012065050.412900-4-aldyh@redhat.com> In-Reply-To: <20221012065050.412900-1-aldyh@redhat.com> References: <20221012065050.412900-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Aldy Hernandez via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Aldy Hernandez <aldyh@redhat.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746463675448002685?= X-GMAIL-MSGID: =?utf-8?q?1746463675448002685?= |
Series |
[COMMITTED] Add method to query the sign of a NAN.
|
|
Commit Message
Aldy Hernandez
Oct. 12, 2022, 6:50 a.m. UTC
In writing some range-op entries I noticed we don't have a way to query the sign of the NAN in a range, unless the range only contains NAN, in which case you can just use frange::signbit_p. This patch adds a method that returns TRUE if there exists the possiblity of a NAN and we know its sign. gcc/ChangeLog: * value-range.h (frange::nan_signbit_p): New. --- gcc/value-range.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
diff --git a/gcc/value-range.h b/gcc/value-range.h index cb5e9d0522c..60b989b2b50 100644 --- a/gcc/value-range.h +++ b/gcc/value-range.h @@ -328,6 +328,7 @@ public: bool maybe_isnan (bool sign) const; bool maybe_isinf () const; bool signbit_p (bool &signbit) const; + bool nan_signbit_p (bool &signbit) const; private: void verify_range (); bool normalize_kind (); @@ -1358,4 +1359,20 @@ frange::signbit_p (bool &signbit) const return false; } +// If range has a NAN with a known sign, set it in SIGNBIT and return +// TRUE. + +inline bool +frange::nan_signbit_p (bool &signbit) const +{ + if (undefined_p ()) + return false; + + if (m_pos_nan == m_neg_nan) + return false; + + signbit = m_neg_nan; + return true; +} + #endif // GCC_VALUE_RANGE_H