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 A17533857360 for ; Mon, 29 Aug 2022 13:31:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A17533857360 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=1661779901; 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=iVX3BNZl+HDcxhbRpRnv7z2oshO7Y/eWAsSouDiRvgE=; b=ABNr607MKmayKCW6MdiG1Eodg2bhQLk0DmETiJdFcG+QWEhAYllnCO/OjXJPyr+T1nry/U oxT6AcTOWkfDe5vB6Bi8+x5j+s4LzPbwuHl2epDsq4EEyxzqR4k7uMhN/fUtXzjoz3ZGfs 21ojOU1/tSImrkEjYWQZgZ3J/qYHezI= Received: from mail-oi1-f199.google.com (mail-oi1-f199.google.com [209.85.167.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-372-DSlyc8D8NF-ecn9-f0a6xw-1; Mon, 29 Aug 2022 09:31:39 -0400 X-MC-Unique: DSlyc8D8NF-ecn9-f0a6xw-1 Received: by mail-oi1-f199.google.com with SMTP id p125-20020acaf183000000b003457457c168so2521911oih.2 for ; Mon, 29 Aug 2022 06:31:38 -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=iVX3BNZl+HDcxhbRpRnv7z2oshO7Y/eWAsSouDiRvgE=; b=iWOUjdHUzfgDZcc/26TKf16yNjf7g5xR3Q/BpzNaJuqRUpvKcDH76SpXRugHF4oxtV JrhCyMkMcvoEfxq21WTvIQJ3ac1wo1PSflrNSPpxfsz06mxDwy6NRhCoh2iF8aXT5oS8 vZGMGdI7OeOW6DYVIgOH8ORZTLnS2ZaZU7G/VSeIEojprbqmjK1+VSEvASmK2J5e3VP8 uQyuLIqqVW94ka+ksM8F0Kf8W4U6yxUt+lHDy55h5u430c2ZoolhfFw5AlJlxtAEjEVE dDBDQQjIHWMUMcfzyzqCq84j75qOJiykK3iVkvLTM0BLGzfc1pJcC4wR34nZBHlEwOEY 9sXw== X-Gm-Message-State: ACgBeo2DjnLxsrAY9UzgCm6zYJVazusYUPQ83XSqLVSonuR7gZSyMN1D jOtHj7J9SJ+3rJvsYvHcnWg9p490bL6hKT7/0J1VrYuqMciMPJJi4cT/3mW16BxZFqT+FMpZ/CF 57/zsDVXxz/6lFfwhPSZVXl41mDV6pHk1Ug== X-Received: by 2002:a05:6808:f0f:b0:343:2e0e:ac52 with SMTP id m15-20020a0568080f0f00b003432e0eac52mr7303672oiw.36.1661779898266; Mon, 29 Aug 2022 06:31:38 -0700 (PDT) X-Google-Smtp-Source: AA6agR4lZleYUuQCmmpUv/gnAtEgYAMz6hbxeOX6Ij8W4ad0TjhKMTiv87CFZXueHqP0DBZ6sdTLUDimXU8B2dOquSk= X-Received: by 2002:a05:6808:f0f:b0:343:2e0e:ac52 with SMTP id m15-20020a0568080f0f00b003432e0eac52mr7303657oiw.36.1661779898016; Mon, 29 Aug 2022 06:31:38 -0700 (PDT) MIME-Version: 1.0 References: <20220826154606.1155977-1-aldyh@redhat.com> In-Reply-To: From: Aldy Hernandez Date: Mon, 29 Aug 2022 15:31:27 +0200 Message-ID: Subject: Re: [PATCH] [ranger] x == -0.0 does not mean we can replace x with -0.0 To: Jakub Jelinek Cc: GCC patches , Andrew MacLeod X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-5.1 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 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. Aldy