From patchwork Tue Oct 25 20:59:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 10984 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1212167wru; Tue, 25 Oct 2022 13:59:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5oNqtil/5i6ASz5yp+Pjj07GZP3D2dXFuXvMXUSt8ctc7x7Q+PHP/QlCNnFfukmoRKtvBO X-Received: by 2002:a17:907:1624:b0:78d:d61c:2b4a with SMTP id hb36-20020a170907162400b0078dd61c2b4amr34073246ejc.208.1666731598697; Tue, 25 Oct 2022 13:59:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666731598; cv=none; d=google.com; s=arc-20160816; b=NOqkEjeAmzsLivOemMFYGVEwWjQfaUsgZZZe8Ll1KyZofCrVnztCrNLw0YocJdu8Hv ykF9nB8T4uONp/T2XNvzDY7cjt9Ycc08yCX1OKdpcLE99GRhHClQH2uKCaQMHyxwuasS Jh480J/uaSsaeFef/JUoCkVqyOgi9GkfntPeNyc/uiwI/ya4CRDxIVTU0/ZA1UctKYg7 ZV11xg9u6ceFnkYcJf6ERKJJV3hbB3dU5Meh/aFSMn5k7hPhmoJcGkdFtffAPUsPPCMl uZfpw3eY8QOiRwCQUIJapntsk8Cu1m43iBxzEv/XuQayNxgObddvDOrdcNpZF7p0w6Ny n7mA== 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=a8GOaOyU1xsICB6BQT7i7NYudbAeQmk6oiWP+Z2piJI=; b=VCmgJSzI2qWBPrsFEL1b8DdpArP8o0pw5hCDmcorV2EWZuq5Xb3CYC/KcO4h2WUiOE GzJt7GDF2UW9oIfiohhgZdm5H6mJfNpvTkOH09x9c4LWqax/P3mEV5/0n+pDlNpKlSlF F4CPhF66+UY8WVPKopxR/czyHODtrrwg/ASA7/365fdUsC0LeljZ0piHgdO7qzh325K/ 8awhDQkGznCSO5puvWKjDLstiAzpQZEM0nC88TmYUqJ5OyKjC+Bmh3GqvdNp3eSuasmy nzCkinOPP2RZrkqSUagQxoERKr8Q8zMPNbcKL+z6zEmCb3DF3M/+X3SX3EPsKdVZ3ec4 GLpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=CJS3wpqM; 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 q5-20020a170906a08500b00780cb1272eesi3301908ejy.466.2022.10.25.13.59.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 13:59:58 -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=CJS3wpqM; 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 E06133856DFC for ; Tue, 25 Oct 2022 20:59:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E06133856DFC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666731596; bh=a8GOaOyU1xsICB6BQT7i7NYudbAeQmk6oiWP+Z2piJI=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=CJS3wpqM1XbHXYlNy41JmL3/Js/9ouCa5Oamai4YUkwPsU5EedIAHOPLNbcsRhbHD 0bQdqdjn5tpWSkkG/SHzMSz/j8jU9u7BUQq66CtwoDJZuLfQKgrQNGzDv/o+3Fk9KA nyP3Nf26OK+Sd723OqGjUzOCBcgLeHTLCSs9C9jA= 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 A3AD33857008 for ; Tue, 25 Oct 2022 20:59:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A3AD33857008 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-542-8SArr4ihNxqpVVmvBfIuQg-1; Tue, 25 Oct 2022 16:59:08 -0400 X-MC-Unique: 8SArr4ihNxqpVVmvBfIuQg-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 0C6BF85A583; Tue, 25 Oct 2022 20:59:08 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.192.78]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AB56340C2064; Tue, 25 Oct 2022 20:59:07 +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 29PKx4cu125088 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 25 Oct 2022 22:59:04 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 29PKx47l125087; Tue, 25 Oct 2022 22:59:04 +0200 To: GCC patches Subject: [PATCH] Convert flag_finite_math_only uses in frange to HONOR_*. Date: Tue, 25 Oct 2022 22:59:01 +0200 Message-Id: <20221025205901.125058-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=-11.6 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, 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: 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?1747694752942576718?= X-GMAIL-MSGID: =?utf-8?q?1747694752942576718?= [As Richi, and probably Jakub, have mentioned in the past...] As mentioned earlier, we should be using HONOR_* on types rather than flag_finite_math_only. Will commit pending tests. gcc/ChangeLog: * value-range.cc (frange::set): Use HONOR_*. (frange::verify_range): Same. * value-range.h (frange_val_min): Same. (frange_val_max): Same. --- gcc/value-range.cc | 6 +++--- gcc/value-range.h | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gcc/value-range.cc b/gcc/value-range.cc index d8ee6ec0d0f..77e5a2cc299 100644 --- a/gcc/value-range.cc +++ b/gcc/value-range.cc @@ -341,7 +341,7 @@ frange::set (tree type, // For -ffinite-math-only we can drop ranges outside the // representable numbers to min/max for the type. - if (flag_finite_math_only) + if (!HONOR_INFINITIES (m_type)) { REAL_VALUE_TYPE min_repr = frange_val_min (m_type); REAL_VALUE_TYPE max_repr = frange_val_max (m_type); @@ -712,8 +712,8 @@ frange::supports_type_p (const_tree type) const void frange::verify_range () { - if (flag_finite_math_only) - gcc_checking_assert (!maybe_isnan ()); + if (!undefined_p ()) + gcc_checking_assert (HONOR_NANS (m_type) || !maybe_isnan ()); switch (m_kind) { case VR_UNDEFINED: diff --git a/gcc/value-range.h b/gcc/value-range.h index b48542a68aa..c87734dd8cd 100644 --- a/gcc/value-range.h +++ b/gcc/value-range.h @@ -1201,10 +1201,10 @@ real_min_representable (const_tree type) inline REAL_VALUE_TYPE frange_val_min (const_tree type) { - if (flag_finite_math_only) - return real_min_representable (type); - else + if (HONOR_INFINITIES (type)) return dconstninf; + else + return real_min_representable (type); } // Return the maximum value for TYPE. @@ -1212,10 +1212,10 @@ frange_val_min (const_tree type) inline REAL_VALUE_TYPE frange_val_max (const_tree type) { - if (flag_finite_math_only) - return real_max_representable (type); - else + if (HONOR_INFINITIES (type)) return dconstinf; + else + return real_max_representable (type); } // Return TRUE if R is the minimum value for TYPE.