From patchwork Fri Oct 14 14:26:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 2702 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212019wrs; Fri, 14 Oct 2022 07:27:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6dBMYTgZ7sD248IeqFJL6zDQbimQuVG9nR475FN0YIL+0lyO3n7CnNRUMLjWMuw9chCHzG X-Received: by 2002:a05:6402:28b7:b0:459:3115:aa07 with SMTP id eg55-20020a05640228b700b004593115aa07mr4286603edb.280.1665757671207; Fri, 14 Oct 2022 07:27:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665757671; cv=none; d=google.com; s=arc-20160816; b=n0oaZ4PEcfM6RT2NdYtSMcW91VhCWuGd2e9F9QZ8tqbumk61g1rO4N5IPwRzUsZQOA rrqdp2a+PUlTqHxU60tQvPDPCIIvYkZkMpYrt4Ok+VKg0/tg1urPubbRGvlqigUCZ18T Y2VuQXFhCZi3uiULbNt/dOrth6SSresybuXjZGZe0G92gbuh5h005MueEMBz381B0CCm s7sTwbMkCW/PSks5YzCFiQzLieq9EXKAHCrWrEIyYgmP99eAhmQXjQ1IdE3lzkFcSIMm nNjx8bVDmGZKbqjsnzj4ZiUU4LZkPrF7gC4s8QpfGI+owXZid3KiypOmszEpGRgsOHNo Dluw== 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=1/XQHtA10jtkJqjhlASQ9818Y1+XDRwnpN6gkiVObi0=; b=zl7vNFzIEq/pgVVgRpgOZRa52Y0qeOWOmf27XwbaQA31YnJxQDrY477z1Tdf2L9vQm Mh4HXUrNPm7pQgD4utHwLwrigVGW6MNbfMMvy329R1+QC0Hql0cYtq8xnmAgltUGsrgM GUvIzU/RlpXTrPsOHOCuDXCuQpbdEWEPc7/5bG7zBOWVj8zLD8R/sIlOJH0VWzRsai+W wX7LRlm6wmEceqNz9A7eYCnqZpVz+Qq40GGaMb0/STwLm4WRYRN5gmfcTYq8o9aUEJrR h44N7OX0J361a3AfwXo7+z8jlgpBxfj79CHHTFG9pqx/JcOOl24FQiXrn1M3buKicx3i PBzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Qv9AxD97; 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 z7-20020a05640235c700b0045c23138cd8si2866403edc.45.2022.10.14.07.27.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Oct 2022 07:27:51 -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=Qv9AxD97; 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 6CB43385020A for ; Fri, 14 Oct 2022 14:27:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6CB43385020A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665757668; bh=1/XQHtA10jtkJqjhlASQ9818Y1+XDRwnpN6gkiVObi0=; 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=Qv9AxD976Kj58Fd71NGCOEVI6SDP0pqFNRVkeP8sL5G6Ylo3+RWuDLKCKRi64fKT+ emgucbPyDzcMlDRtZncm6/LK+OeCIoPXpSNvIDhWjYHGHauIuJFmfZjdI8Sp2EajZP ldtDrCEhQDWZntRMHzprhcLXJtgNdmORooMdSdkI= 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 6B5E338582B7 for ; Fri, 14 Oct 2022 14:27:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6B5E338582B7 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-594-sEy8cTLQOC6HuHjkPxpXQQ-1; Fri, 14 Oct 2022 10:26:59 -0400 X-MC-Unique: sEy8cTLQOC6HuHjkPxpXQQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A4D8F380673F for ; Fri, 14 Oct 2022 14:26:59 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.195.163]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5E36B416361; Fri, 14 Oct 2022 14:26:59 +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 29EEQvX9671512 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 14 Oct 2022 16:26:57 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 29EEQv2d671511; Fri, 14 Oct 2022 16:26:57 +0200 To: GCC patches Subject: [COMMITTED] Normalize ranges over the range for both bounds when -ffinite-math-only. Date: Fri, 14 Oct 2022 16:26:51 +0200 Message-Id: <20221014142652.671475-2-aldyh@redhat.com> In-Reply-To: <20221014142652.671475-1-aldyh@redhat.com> References: <20221014142652.671475-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Aldy Hernandez via Gcc-patches From: Aldy Hernandez Reply-To: Aldy Hernandez 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?1746673515713606735?= X-GMAIL-MSGID: =?utf-8?q?1746673515713606735?= [-Inf, +Inf] was being chopped correctly for -ffinite-math-only, but [-Inf, -Inf] was not. This was latent because a bug in real_isdenormal is causing us to flush -Inf to zero. gcc/ChangeLog: * value-range.cc (frange::set): Normalize ranges for both bounds. --- gcc/value-range.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/value-range.cc b/gcc/value-range.cc index 86550f158b8..6b4f3dddcd5 100644 --- a/gcc/value-range.cc +++ b/gcc/value-range.cc @@ -340,8 +340,12 @@ frange::set (tree type, REAL_VALUE_TYPE max_repr = frange_val_max (m_type); if (real_less (&m_min, &min_repr)) m_min = min_repr; + else if (real_less (&max_repr, &m_min)) + m_min = max_repr; if (real_less (&max_repr, &m_max)) m_max = max_repr; + else if (real_less (&m_max, &min_repr)) + m_max = min_repr; } // Check for swapped ranges.