From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 2CB98385841F for ; Wed, 14 Sep 2022 15:09:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2CB98385841F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663168141; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I34hro3Mr5mYQtNl3jAwufTCVBBJIazJThKDRrZ2fWE=; b=fbqlObO8P60b7cXNiEO11pOyaKskac//Y63ziyjhB/odP72c2UPJhyS+Vg7bkV8aL3ARTI QmePuIEcpPBmyuSIYiLvKN5QHM2/iEHKl2RHOWvYqZH5sAE7EZ5KHYgJmg25XjpT8wNbcl XQc7TXAp9K9+JSJ5kfQ3g/L18f6jL6Y= 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-482-7lFyZqWCMtaJjbkvQdFK6Q-1; Wed, 14 Sep 2022 11:09:00 -0400 X-MC-Unique: 7lFyZqWCMtaJjbkvQdFK6Q-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 55788185A78F for ; Wed, 14 Sep 2022 15:09:00 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.40.192.189]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0102F2027063; Wed, 14 Sep 2022 15:08: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 28EF8w8o1244453 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 14 Sep 2022 17:08:58 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 28EF8w5k1244452; Wed, 14 Sep 2022 17:08:58 +0200 From: Aldy Hernandez To: GCC patches Cc: Andrew MacLeod , Aldy Hernandez Subject: [COMMITTED] Use frange::set_nan() from the generic frange::set(). Date: Wed, 14 Sep 2022 17:08:50 +0200 Message-Id: <20220914150852.1244397-3-aldyh@redhat.com> In-Reply-To: <20220914150852.1244397-1-aldyh@redhat.com> References: <20220914150852.1244397-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This patch cleans up the frange::set() code by passing all things NAN to frange::set_nan(). No functional changes. Regstrapped on x86-64 Linux, plus I ran selftests for -ffinite-math-only. gcc/ChangeLog: * value-range.cc (frange::set): Use set_nan. * value-range.h (frange::set_nan): Inline code originally in set(). --- gcc/value-range.cc | 27 ++++++++++++++------------- gcc/value-range.h | 9 ++++++++- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/gcc/value-range.cc b/gcc/value-range.cc index dd827421aca..d759fcf178c 100644 --- a/gcc/value-range.cc +++ b/gcc/value-range.cc @@ -369,32 +369,33 @@ frange::set (tree min, tree max, value_range_kind kind) return; } + // Handle NANs. + if (real_isnan (TREE_REAL_CST_PTR (min)) || real_isnan (TREE_REAL_CST_PTR (max))) + { + gcc_checking_assert (real_identical (TREE_REAL_CST_PTR (min), + TREE_REAL_CST_PTR (max))); + tree type = TREE_TYPE (min); + set_nan (type); + return; + } + m_kind = kind; m_type = TREE_TYPE (min); m_props.set_varying (); m_min = *TREE_REAL_CST_PTR (min); m_max = *TREE_REAL_CST_PTR (max); - bool is_nan = (real_isnan (TREE_REAL_CST_PTR (min)) - || real_isnan (TREE_REAL_CST_PTR (max))); - - // Ranges with a NAN and a non-NAN endpoint are nonsensical. - gcc_checking_assert (!is_nan || operand_equal_p (min, max)); - - // Set NAN property if we're absolutely sure. - if (is_nan && operand_equal_p (min, max)) - m_props.nan_set_yes (); - else if (!HONOR_NANS (m_type)) - m_props.nan_set_no (); - // Set SIGNBIT property for positive and negative ranges. if (real_less (&m_max, &dconst0)) m_props.signbit_set_yes (); else if (real_less (&dconst0, &m_min)) m_props.signbit_set_no (); + if (!HONOR_NANS (m_type)) + m_props.nan_set_no (); + // Check for swapped ranges. - gcc_checking_assert (is_nan || tree_compare (LE_EXPR, min, max)); + gcc_checking_assert (tree_compare (LE_EXPR, min, max)); normalize_kind (); if (flag_checking) diff --git a/gcc/value-range.h b/gcc/value-range.h index 6e896eb9ab5..4392de84c8b 100644 --- a/gcc/value-range.h +++ b/gcc/value-range.h @@ -1193,7 +1193,14 @@ frange::set_nan (tree type) { REAL_VALUE_TYPE r; gcc_assert (real_nan (&r, "", 1, TYPE_MODE (type))); - set (type, r, r); + m_kind = VR_RANGE; + m_type = type; + m_min = r; + m_max = r; + m_props.set_varying (); + m_props.nan_set_yes (); + if (flag_checking) + verify_range (); } // Return TRUE if range is known to be finite. -- 2.37.1