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 DC0FB3858D32 for ; Mon, 29 Aug 2022 13:22:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DC0FB3858D32 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=1661779322; 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=ONtqXvdh09FnBmaSzGrDXuYnrWXslGkrKe2/Rhdd4jA=; b=Qng4jISXnaeuHxSUuWT0HrYd8+26iGTdyjt8iB8MJaWqdNH8LXUSUmtbNszQt6bfwkz//G 9NcBT/uDA+Mku/Au3dClJ8V3SwYvku5M9YxDu/ev64I7+rtpx6Mv0bFBh6pFx+VMmHes2d luX4dxh8ZXWf18jkbBBfZr7rPAB3BXQ= 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-520-JDwEulstOkKQOdWh1a4Nag-1; Mon, 29 Aug 2022 09:22:00 -0400 X-MC-Unique: JDwEulstOkKQOdWh1a4Nag-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 93337101AA64 for ; Mon, 29 Aug 2022 13:22:00 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 450B12166B26; Mon, 29 Aug 2022 13:22:00 +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 27TDLvdQ2146074 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 29 Aug 2022 15:21:57 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 27TDLveM2146073; Mon, 29 Aug 2022 15:21:57 +0200 Date: Mon, 29 Aug 2022 15:21:56 +0200 From: Jakub Jelinek To: Aldy Hernandez Cc: GCC patches , Andrew MacLeod Subject: Re: [PATCH] [ranger] x == -0.0 does not mean we can replace x with -0.0 Message-ID: Reply-To: Jakub Jelinek References: <20220826154606.1155977-1-aldyh@redhat.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no 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 03:13:21PM +0200, Aldy Hernandez wrote: > It seems to me we can do this optimization regardless, but then treat > positive and negative zero the same throughout the frange class. > Particularly, in frange::singleton_p(). We should never return TRUE > for any version of 0.0. This will keep VRP from propagating an > incorrect 0.0, since all VRP does is propagate when a range is > provably a singleton. Also, frange::zero_p() shall return true for > any version of 0.0. Well, I think for HONOR_SIGNED_ZEROS it would be nice if frange was able to differentiate between 0.0 and -0.0. One reason is e.g. to be able to optimize copysign/signbit - if we can prove that the sign bit on some value will be always cleared or always set, we can fold those. On the other side, with -fno-signed-zeros it is invalid to use copysign/signbit on values that could be zero (well, nothing guarantees whether the sign bit is set or clear), so for MODE_HAS_SIGNED_ZEROS && !HONOR_SIGNED_ZEROS it is best to treat contains_p as {-0.0,0.0} being one thing (just not singleton_p) and not bother with details like whether a range ends or starts with -0.0 or 0.0, either of them would work the same. And for !MODE_HAS_SIGNED_ZEROS, obviously 0.0 can be singleton_p. Jakub