Message ID | 20220921113039.2173181-1-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:a05:7301:2302:b0:79:6ae5:3758 with SMTP id gv2csp2778620dyb; Wed, 21 Sep 2022 04:34:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4xoXK7xGmtKiQ3q4TV3jNbOfSoVO7tv10NgrNfxz1G+RuO7SOz5ILJr5Q+7ivfqzi+5n9d X-Received: by 2002:a17:907:a0c7:b0:77f:a9d2:9be2 with SMTP id hw7-20020a170907a0c700b0077fa9d29be2mr19998961ejc.352.1663760048338; Wed, 21 Sep 2022 04:34:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663760048; cv=none; d=google.com; s=arc-20160816; b=oJ3k7+b6un5hJKHyZMFD3HrGB5rvCAE3E/x3zv6bxe8+EfybbW8A/vkXsyUQ+SfhiK gEbcOYQnNragN6JBICQUlXcWEI87J6ZCnbD0ONq+CAUsTwY5XbILbmsLY4fKRBasiYyC onniH0Can/+IfjAmNcw9Ffe4/kzDxxVEHsXkILWfWoqnuOrAEPTYiN2Gn0s3lPWEKc14 z34Ku9Ebh2tV4SkSV/LA0z5z15zVqZn9V66+P2Bi3NMeZDC8syJ/zrBUsLr+0C0ITPDx hDZfhPaVWRktX7OfN4wNiFGyzyjmesuQliLGFngU7b3Id6QXQxYzvYWE6qrjW2AL7az/ G2nA== 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=ArmuwxV9h9KD4d65X44DH1cGTIoUrUmpw/8liwvwae0=; b=RyaHJR9FOT3b2hgO7TeynIppvJGni/kjwl7o1keWDzo0DiZC0H7rdpY56Tk9BixQZ6 u2IUAdcZFhL8S221cf7WYDCoCnScaIWX6MZQqw19g+3pn9L98beff2n91H4eSVjNaZe4 SBn294axP3tQMd4bIKHfZu/ggisqcaVYsczo+vVpIUut99zlb7bVPvX8q5rbr/JgCLzF cM/H8WMf4J2GJMrPYKRalwD5b8twqoHoL6brW1CsjHaYlfmXsVS2Pe9CpmxHgX3ehMEn mZ/6DLAt18ysTTcRJPLVzVwEfYr+akc1m9Jfdv/te42cJIZQQcVH6XyrdQng3yZ1yuNo pvkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="roaphb/G"; 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 k23-20020a508ad7000000b0044eb578b565si2286625edk.102.2022.09.21.04.34.08 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Sep 2022 04:34:08 -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="roaphb/G"; 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 ACC66385800E for <ouuuleilei@gmail.com>; Wed, 21 Sep 2022 11:34:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ACC66385800E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663760044; bh=ArmuwxV9h9KD4d65X44DH1cGTIoUrUmpw/8liwvwae0=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=roaphb/G/tg0F/r4WiAhicVjrXP5kKWEap9aJsGYTYKhq+SkZWt2msqXEDrSF+T0n uSji5Y4fIO2LT1An0ocFnygzD9D3bB22CCgZqLXnZgsN1P+ePVp22raZwYL2OGPjmv Bv2Bmk5NerUQ3TPLR9zmsDVGFo0CpWWT4ULWTxHs= 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 2F0C73858C52 for <gcc-patches@gcc.gnu.org>; Wed, 21 Sep 2022 11:33:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2F0C73858C52 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-498-jQrIZphdN_i8arwCqx0cog-1; Wed, 21 Sep 2022 07:33:16 -0400 X-MC-Unique: jQrIZphdN_i8arwCqx0cog-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 80A83101A5DC; Wed, 21 Sep 2022 11:33:16 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.192.63]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 22F9649BB63; Wed, 21 Sep 2022 11:33:15 +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 28LBXD1a2173329 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 21 Sep 2022 13:33:13 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 28LBXDuf2173328; Wed, 21 Sep 2022 13:33:13 +0200 To: GCC patches <gcc-patches@gcc.gnu.org> Subject: [COMMITTED] [PR106967] Set known NANs to undefined for flag_finite_math_only. Date: Wed, 21 Sep 2022 13:30:40 +0200 Message-Id: <20220921113039.2173181-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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=-11.8 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_LOW, 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?1744578856303864191?= X-GMAIL-MSGID: =?utf-8?q?1744578856303864191?= |
Series |
[COMMITTED,PR106967] Set known NANs to undefined for flag_finite_math_only.
|
|
Commit Message
Aldy Hernandez
Sept. 21, 2022, 11:30 a.m. UTC
Richard, this is what you suggested. Thanks. Explicit NANs in the IL can be treated as undefined for flag_finite_math_only. This causes all the right things to happen wrt threading, folding, etc. It also saves us special casing throughout. It occurs to me that we should do something similar for infinities for -ffinite-math-only. That is, drop them to the min/max representable numbers, and adjust everything (including VARYING endpoints) accordingly. Furthermore, we should saturate to min/max representable in the setter, so (upcoming) binary operators don't have to worry about going over min/max. Sigh...floating point... the gift that keeps on giving. gcc/ChangeLog: * value-range.cc (frange::set): Set known NANs to undefined for flag_finite_math_only. --- gcc/value-range.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/gcc/value-range.cc b/gcc/value-range.cc index 505eb9211a7..7e8028eced2 100644 --- a/gcc/value-range.cc +++ b/gcc/value-range.cc @@ -313,8 +313,13 @@ frange::set (tree min, tree max, value_range_kind kind) gcc_checking_assert (real_identical (TREE_REAL_CST_PTR (min), TREE_REAL_CST_PTR (max))); tree type = TREE_TYPE (min); - bool sign = real_isneg (TREE_REAL_CST_PTR (min)); - set_nan (type, sign); + if (HONOR_NANS (type)) + { + bool sign = real_isneg (TREE_REAL_CST_PTR (min)); + set_nan (type, sign); + } + else + set_undefined (); return; }