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.129.124]) by sourceware.org (Postfix) with ESMTPS id C6F88385700A for ; Mon, 29 Aug 2022 14:17:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C6F88385700A 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=1661782658; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=c+Wo31rhgwtT5VmYh/QK0d3wMSB7nKhOfrkuzkEgS98=; b=NhcxWnO/w74qXJZAHzUuIVw8VfezftDTNR4E/I7RpGdVTO9b6BTcJH3g+O3c33NoA8Mbm2 rs6ONrKX7xlq+9CPorgBF/5m3WPDUgZg2ff/oN4WnLeoW9i+sInG5tAQOB7XLIDHh1ggh+ MVSre1r/c8QbputDBLNNEgRLn6GLoBI= 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-277--gg2NsypNuaBKr0uFvRsJQ-1; Mon, 29 Aug 2022 10:17:35 -0400 X-MC-Unique: -gg2NsypNuaBKr0uFvRsJQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EBB533C0D840; Mon, 29 Aug 2022 14:17:34 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AC6C94010D2A; Mon, 29 Aug 2022 14:17:34 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 27TEHWLd2146272 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 29 Aug 2022 16:17:32 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 27TEHVV72146271; Mon, 29 Aug 2022 16:17:31 +0200 Date: Mon, 29 Aug 2022 16:17:31 +0200 From: Jakub Jelinek To: Aldy Hernandez Cc: GCC patches , Andrew MacLeod , Andrew Pinski Subject: Re: [PATCH] Add support for floating point endpoints to frange. Message-ID: Reply-To: Jakub Jelinek References: <20220823114224.904934-1-aldyh@redhat.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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: On Mon, Aug 29, 2022 at 04:08:58PM +0200, Aldy Hernandez wrote: > On Mon, Aug 29, 2022 at 3:55 PM Jakub Jelinek wrote: > > > > On Mon, Aug 29, 2022 at 03:45:33PM +0200, Aldy Hernandez wrote: > > > For convenience, singleton_p() returns false for a NAN. IMO, it makes > > > the implementation cleaner, but I'm not wed to the idea if someone > > > objects. > > > > If singleton_p() is used to decide whether one can just replace a variable > > with singleton range with a constant, then certainly. > > If MODE_HAS_SIGNED_ZEROS, zero has 2 representations (-0.0 and 0.0) and > > NaNs have lots of different representations (the sign bit is ignored > > except for stuff like copysign/signbit, there are qNaNs and sNaNs and > > except for the single case how Inf is represented, all other values of the > > mantissa mean different representations of NaN). So, unless we track which > > exact form of NaN can appear, NaN or any [x, x] range with NaN property > > Ok that was more or less what I was thinking. And no, we don't keep > track of the type of NANs. > > How does this look? > > bool > frange::singleton_p (tree *result) const > { > if (m_kind == VR_RANGE && real_identical (&m_min, &m_max)) > { > // If we're honoring signed zeros, fail because we don't know > // which zero we have. This avoids propagating the wrong zero. > if (HONOR_SIGNED_ZEROS (m_type) && zero_p ()) > return false; > > // Return false for any singleton that may be a NAN. > if (!get_nan ().no_p ()) > return false; Perhaps if (HONOR_NANS (m_type) && !get_nan ().no_p ()) instead? Or do you ensure the nan property is never set for -ffinite-math-only? > > if (result) > *result = build_real (m_type, m_min); > return true; > } > return false; > } Otherwise LGTM. Jakub