From patchwork Fri Oct 14 14:26:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 2703 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212029wrs; Fri, 14 Oct 2022 07:27:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4YsuJsKn6lUmV7GuZU/puYTEK1aECmWxMobKg6Yaproyc+XivO2e5ZOBHG6SP4w7wfgDpk X-Received: by 2002:a17:907:703:b0:78e:25be:5455 with SMTP id xb3-20020a170907070300b0078e25be5455mr2341047ejb.630.1665757672060; Fri, 14 Oct 2022 07:27:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665757672; cv=none; d=google.com; s=arc-20160816; b=VfwSCS0BoWML3GtxZPnKylChPKeGHwpxehDiEWbF0VSOT6rb8EXMKQtvkBRofHxQrl LlPdLBIKsQ0EGWEjB85rC6ijXtYrwMOgtzk7jcxBf77Zs3+i5p2EYBlXsN+Iy4PLhOPO rl6mZ/uoP6Eigui9Und+CqeCrNV4LkE71+QXKTwSG0XiAllHl8X9Glf9FicIacS5pY42 3bpLE7yaeGySpwgEvlu6sw2mEfVTf9wQYHPcd5j5z9Jxr3qUpScFtsVB9N+yhjNffOja fAcfGI6pPB/ZVzZYM4BkzspcvsDG2ci9DbPAurHjn0U8x72OVLHtGxovVRwZQYWeTzYL A0fA== 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:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=pDMZYvR2AcLuGFyDtclaOonyOh1lS2FRywgqOn7pJaU=; b=XYVhlAoUNCswlFIS3CYNmPKAxgstFcQ2+jY4XMh9jvuxN3TGdwhIN8laPNzQ1OU9Aa sJ6dcJ3JG1bi1fpjaoGppU+xUR/bGmKUUvKL2G5pJdXfPhl9TvV6OVIi/Me6Nuzteovq TGgPRlqQD+AcBSa8zAjlkxekN0tMDMQbWFXT6BsK+VuEzAmh7FxSvOxS4DO7FlJjiCJ4 V0ngtzh12DqtoEYP0b0EEY5CeRMfUDCI+BAbaz65j0vmbr8drujzmixmWEfs5tLUCTqH VYWpbCmw2ZItQjk0MZ//MeKK6vT17fw4G1XSxNlE5CPTuJTwhZqKaRA6Up7eQ7Sf0VXl hOkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=M6IutD7R; 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 jz18-20020a17090775f200b0078d00203ab4si1902569ejc.691.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:52 -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=M6IutD7R; 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 4A61B386076D for ; Fri, 14 Oct 2022 14:27:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4A61B386076D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665757669; bh=pDMZYvR2AcLuGFyDtclaOonyOh1lS2FRywgqOn7pJaU=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=M6IutD7RiZtWzYev3eLgS0M9WDpQpZcnIeywWM3Z4mr/zx5kb0BrkuuptCQTuEb0C cD4MnyTj5mIpvDWflRRP3Hrj7lRLmyLBNGtH4J95gvpugDGOBz3iSXHdLmX0V5weN7 u3ChsaKGrYfpTJcQ4R5PU5xqu2FU4caNrP/NyeLY= 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 1A6213858C83 for ; Fri, 14 Oct 2022 14:27:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1A6213858C83 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-156-RbOTNL42NgiGncI95pT6Pw-1; Fri, 14 Oct 2022 10:26:59 -0400 X-MC-Unique: RbOTNL42NgiGncI95pT6Pw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3C2D129324AA 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 D62AD40F9D40; Fri, 14 Oct 2022 14:26:58 +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 29EEQuog671507 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 14 Oct 2022 16:26:56 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 29EEQun4671505; Fri, 14 Oct 2022 16:26:56 +0200 To: GCC patches Subject: [COMMITTED] Drop -0.0 in frange::set() for !HONOR_SIGNED_ZEROS. Date: Fri, 14 Oct 2022 16:26:50 +0200 Message-Id: <20221014142652.671475-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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?1746673517090657475?= X-GMAIL-MSGID: =?utf-8?q?1746673517090657475?= Similar to what we do for NANs when !HONOR_NANS and Inf when flag_finite_math_only, we can remove -0.0 from the range at creation time. We were kinda sorta doing this because there is a bug in real_isdenormal that is causing flush_denormals_to_zero to saturate [x, -0.0] to [x, +0.0] when !HONOR_SIGNED_ZEROS. Fixing this bug (upcoming), causes us to leave -0.0 in places where we aren't expecting it (the intersection code). gcc/ChangeLog: * value-range.cc (frange::set): Drop -0.0 for !HONOR_SIGNED_ZEROS. --- gcc/value-range.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcc/value-range.cc b/gcc/value-range.cc index 26a2b782e2c..86550f158b8 100644 --- a/gcc/value-range.cc +++ b/gcc/value-range.cc @@ -324,6 +324,14 @@ frange::set (tree type, m_neg_nan = false; } + if (!HONOR_SIGNED_ZEROS (m_type)) + { + if (real_iszero (&m_min, 1)) + m_min.sign = 0; + if (real_iszero (&m_max, 1)) + m_max.sign = 0; + } + // For -ffinite-math-only we can drop ranges outside the // representable numbers to min/max for the type. if (flag_finite_math_only)