From patchwork Fri Mar 31 10:57:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 77721 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp471781vqo; Fri, 31 Mar 2023 03:58:30 -0700 (PDT) X-Google-Smtp-Source: AKy350a7W+PClQ/yFRFoi7laWiHUZAP/Yx1Vgkfy73lKwxvyckY2nYtugxpni4F28gE1YbEDLH3S X-Received: by 2002:aa7:d782:0:b0:502:4d8c:c836 with SMTP id s2-20020aa7d782000000b005024d8cc836mr13490437edq.10.1680260310273; Fri, 31 Mar 2023 03:58:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680260310; cv=none; d=google.com; s=arc-20160816; b=EKWeQTUJV0bsYWcRGyef5NNv1KjPoVgyRMhKM5rFD8lzLpMGVc4MZb8f0DzvWH0dtD dCaSi0yq2im77DbiLJLEl2X0bIsP6bis0ayg+rekqQ9ZWEVtbwznI6nNXf19q+0Cj+El imHrRR2m2CHUFR4G0Jk2KlIS3FzFhKkoGV6R8k/7ohT1DjGnlNlbLBw3Qa5k/KoxWZ9e qiZ+qpaVbOJRAtTk9NzuxmB9z5dr8qF7nyvipdfOUEFkHIeRS78ySONNel7fRTNHsmZx 13kkNdlz27CU7FnCRN9VUR/aJ12NFjzzInsz1TMZridqFteXoPrDt9ogWtgfU9POYV+/ ai8g== 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-disposition:in-reply-to:mime-version:references:message-id :subject:cc:to:date:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=sJiptCACadqPH7it2SZFxMMGLneNw9mIhaKRcFIj+e8=; b=eAMvXzmCBHxBvK7iQp0pFBT01Gey4Kxht2GbkJOEILKaWrHCUO96QClaEZvHpRswhB Bkvp7UVWFztQboLxN/Epv/NZuhsGbsqvwiDaOQTSvV1Q/cjaOL+u83b0d8zFkdYbXnkx TiktOL4PYCY6sdNSLe+wAIcJ+bxuOiEVSZ3yXj1yrps7xM4TbSyRERW8OfWeWRIJD+fL spdIfsn2dpygWdHERE4aXsA1MT1ig5Vnjyzw8cMjEjfpocXszrSr4wxLyhCYelm/yJYW 2A3xyaqx5wHZlNmrpm/ddCBtLmrHCpVNePdn0g2L7z18tOhgstgNQFywkw34JGcvbO/o Jqsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=JVxAf2rM; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id e15-20020a50fb8f000000b005024b0f5b4fsi1207416edq.213.2023.03.31.03.58.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Mar 2023 03:58:30 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=JVxAf2rM; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 52C493855580 for ; Fri, 31 Mar 2023 10:58:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 52C493855580 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680260302; bh=sJiptCACadqPH7it2SZFxMMGLneNw9mIhaKRcFIj+e8=; h=Date:To:Cc:Subject:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=JVxAf2rM6Cu//7nckNTpfYnUHXmHl9UhUTOWYZSj1mBx6BPspF4CJf542oeQcedIc DVMvfae91dAKOjIn5K2clPKc44LqKWaZh0TlXfTPoaKsHmAxi7sQCxF+DKEYFgXZJo IbpJPuk+sT1rMFV87Kj2gBYEAVUcx9V39gfq50P8= 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.133.124]) by sourceware.org (Postfix) with ESMTPS id 57A7C3858D33 for ; Fri, 31 Mar 2023 10:57:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 57A7C3858D33 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-494-9KplNIRVNq-LSj0oX_agWQ-1; Fri, 31 Mar 2023 06:57:36 -0400 X-MC-Unique: 9KplNIRVNq-LSj0oX_agWQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 859B6282380F for ; Fri, 31 Mar 2023 10:57:36 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 466301402C06; Fri, 31 Mar 2023 10:57:36 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 32VAvXTK3974658 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 31 Mar 2023 12:57:34 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 32VAvXQb3974657; Fri, 31 Mar 2023 12:57:33 +0200 Date: Fri, 31 Mar 2023 12:57:33 +0200 To: Aldy Hernandez , Andrew MacLeod Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] range-op-float: Further foperator_{,not_}equal::fold_range fix Message-ID: References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761880634988212507?= X-GMAIL-MSGID: =?utf-8?q?1761880634988212507?= On Fri, Mar 31, 2023 at 12:45:10PM +0200, Jakub Jelinek via Gcc-patches wrote: > - there is a missing case (not handled in this patch) where both operands > are known to be zeros, but not singleton zeros This patch adds those cases. Ok for trunk if it passes bootstrap/regtest? 2023-03-31 Jakub Jelinek * range-op-float.cc (foperator_equal::fold_range): If at least one of the op ranges is not singleton and neither is NaN and all 4 bounds are zero, return [1, 1]. (foperator_not_equal::fold_range): In the same case return [0, 0]. Jakub --- gcc/range-op-float.cc.jj 2023-03-31 11:23:04.817876083 +0200 +++ gcc/range-op-float.cc 2023-03-31 12:51:34.757480162 +0200 @@ -616,6 +616,13 @@ foperator_equal::fold_range (irange &r, else r = range_false (type); } + else if (real_iszero (&op1.lower_bound ()) + && real_iszero (&op1.upper_bound ()) + && real_iszero (&op2.lower_bound ()) + && real_iszero (&op2.upper_bound ()) + && !maybe_isnan (op1, op2)) + // [-0.0, 0.0] == [-0.0, 0.0] or similar. + r = range_true (type); else { // If ranges do not intersect, we know the range is not equal, @@ -732,6 +739,13 @@ foperator_not_equal::fold_range (irange else r = range_true (type); } + else if (real_iszero (&op1.lower_bound ()) + && real_iszero (&op1.upper_bound ()) + && real_iszero (&op2.lower_bound ()) + && real_iszero (&op2.upper_bound ()) + && !maybe_isnan (op1, op2)) + // [-0.0, 0.0] != [-0.0, 0.0] or similar. + r = range_false (type); else { // If ranges do not intersect, we know the range is not equal,