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 97FA73857C7E for ; Mon, 29 Aug 2022 14:26:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 97FA73857C7E 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=1661783196; 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: in-reply-to:in-reply-to:references:references; bh=D/LuvmrbjLP+IW1ioeIrR8F4k4IpUQnMrNAFXUofkB4=; b=P+h2kpE/G3swecizUgJod4Zz+q5dBf0CXDuNpGeRVYaWS0IPuoaecO/5XigX56Kcau67I1 5bRHjOnIDs1LNB0n9eAUb+HtIWwJn1UnPJVdRv8GnsG/YKvo611NcQElt9O2HSuvfd8C2W x8oVyaEU5ISWTjIJ+NnEfJq8zjhK2So= Received: from mail-ot1-f72.google.com (mail-ot1-f72.google.com [209.85.210.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-34-Zbuxa4VSM_2ZrNnrSQ9OCw-1; Mon, 29 Aug 2022 10:26:34 -0400 X-MC-Unique: Zbuxa4VSM_2ZrNnrSQ9OCw-1 Received: by mail-ot1-f72.google.com with SMTP id cp8-20020a056830660800b006388a844bdaso4669953otb.17 for ; Mon, 29 Aug 2022 07:26:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=D/LuvmrbjLP+IW1ioeIrR8F4k4IpUQnMrNAFXUofkB4=; b=iVZ041LbXP4pFz5nQ+yr7dK/tOAPAlqWZfTvB36h2PNxeM93K78lSaP6rCEILey1B1 2Sbgt0IwPwxnXhZAsqXbn+FSuAg/O9hqy5oSmSdfYomwRT6DR25/aFrbc/0iWz2rvIga 6pk9fyJOdf+xpYM+Z045UOInP6+2C+9ByhdHGfsi67QoR5ylPHWCnC2Ebe8melm06tAG 0YzgiJTLmg0posl83Lbbz6pD64T2NMC40CC84D57p+NtOyu2I3/YUcP1RcrEOdH+mwqK 1Kq2Br5EWLtsr9IiMT3mjjo7O+uwC8zmqEQtNDV4g5Ijiqxb2diQrHmu8aZrl4IDbV7o InGQ== X-Gm-Message-State: ACgBeo2yvKnVNryvnDY3h0i7+8HhuIfesBX/PdQSV+KFfIRnlH/oVVDf HDq88vQZhd/4sEieJMMVTOyfgROY5mx6mEvB9kjk8HW1j/jImW5J6AUMaCX4ARNX0ZXo28p5MdC dRJHZGjC04UVZ7KSMTHTtIrZfODw7zixfSA== X-Received: by 2002:a05:6870:b617:b0:10d:f7ce:50df with SMTP id cm23-20020a056870b61700b0010df7ce50dfmr8022513oab.36.1661783194084; Mon, 29 Aug 2022 07:26:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR4gMxbK4IGtWFBT/VJ1Kd6u6hlltDvGWSF27Jtf6kXZIGqBDHqdRz9MvdAoAxZfKT56W6ftR4s3BratXiFmGPY= X-Received: by 2002:a05:6870:b617:b0:10d:f7ce:50df with SMTP id cm23-20020a056870b61700b0010df7ce50dfmr8022506oab.36.1661783193842; Mon, 29 Aug 2022 07:26:33 -0700 (PDT) MIME-Version: 1.0 References: <20220826154606.1155977-1-aldyh@redhat.com> <616b4af5-e3b7-844e-5dcf-a73a5280d114@gmail.com> In-Reply-To: <616b4af5-e3b7-844e-5dcf-a73a5280d114@gmail.com> From: Aldy Hernandez Date: Mon, 29 Aug 2022 16:26:23 +0200 Message-ID: Subject: Re: [PATCH] [ranger] x == -0.0 does not mean we can replace x with -0.0 To: Jeff Law Cc: gcc-patches X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-5.2 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 4:22 PM Jeff Law via Gcc-patches wrote: > > > > On 8/29/2022 7:31 AM, Aldy Hernandez via Gcc-patches wrote: > > On Mon, Aug 29, 2022 at 3:22 PM Jakub Jelinek wrote: > >> 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. > > *head explodes* > > > > Ok, I think I can add a zero property we can track (like we do for > > NAN), and set it appropriately at constant creation and upon results > > from copysign/signbit. However, I am running out of time before > > Cauldron, so I think I'll just treat +-0.0 ambiguously for now, and do > > that as a follow-up. > We definitely want to be able to track +-0.0 and distinguish between > them. IIRC there's cases where you can start eliminating comparisons > and arithmetic once you start tracking -0.0 state. Absolutely. That was always the plan. However, my goal was just to add relop stubs so others could flesh out the rest. Alas, I'm way over that now :). We're tracking NANs, endpoints, infinities, etc. However, I'm hoping to forget as many floating point details, as fast as possible, as soon as I can ;-). Aldy