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 D4680386076D for ; Fri, 14 Oct 2022 14:33:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D4680386076D 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=1665757981; 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=DFkrAur3IFm44fqFkQVSsMZi9oAgFFwVZ9ZvGLl7lM0=; b=ZEgmJU5dKs/glytOUC92ipO8q2j4eKk+Fwh3k7p0nEf8ANZrBglez7jsafVAWPfs/7pgMc e8JSmlRoZIiqOF+Juc6p7jVsYIm0mVPnNKQugbtGhtNdEz9vLwHpuvs+WGXhgMaejXFv5S eVu40FjxQuJn9PBeAyJ9uGml7vLSEEs= 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-37-UZ3HOKmhOXG4NUbRi6fHlA-1; Fri, 14 Oct 2022 10:33:00 -0400 X-MC-Unique: UZ3HOKmhOXG4NUbRi6fHlA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B8F2F3C0F43A for ; Fri, 14 Oct 2022 14:32:59 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.55]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7AB6D1401693; Fri, 14 Oct 2022 14:32:59 +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 29EEWu2i2564084 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 14 Oct 2022 16:32:57 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 29EEWpMw2564083; Fri, 14 Oct 2022 16:32:51 +0200 Date: Fri, 14 Oct 2022 16:32:46 +0200 From: Jakub Jelinek To: Aldy Hernandez Cc: GCC patches Subject: Re: [COMMITTED] Drop -0.0 in frange::set() for !HONOR_SIGNED_ZEROS. Message-ID: Reply-To: Jakub Jelinek References: <20221014142652.671475-1-aldyh@redhat.com> MIME-Version: 1.0 In-Reply-To: <20221014142652.671475-1-aldyh@redhat.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP 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 Fri, Oct 14, 2022 at 04:26:50PM +0200, Aldy Hernandez via Gcc-patches wrote: > Similar to what we do for NANs when !HONOR_NANS and Inf when > flag_finite_math_only, we can remove -0.0 from the range at creation > time. > > We were kinda sorta doing this because there is a bug in > real_isdenormal that is causing flush_denormals_to_zero to saturate > [x, -0.0] to [x, +0.0] when !HONOR_SIGNED_ZEROS. Fixing this bug > (upcoming), causes us to leave -0.0 in places where we aren't > expecting it (the intersection code). > > gcc/ChangeLog: > > * value-range.cc (frange::set): Drop -0.0 for !HONOR_SIGNED_ZEROS. This looks wrong to me. !HONOR_NANS is different from !HONOR_SIGNED_ZEROS. The former says that either NaNs aren't supported or if they appear, it will be UB. The latter says that either -0.0 doesn't exist, or user doesn't care if -0.0 or 0.0 is used. So, what you do is ok for !MODE_HAS_SIGNED_ZEROS (TYPE_MODE (m_type)), but otherwise we want to canonicalize [x, -0.0] to [x, 0.0] and [0.0, y] to [-0.0, y]. > --- a/gcc/value-range.cc > +++ b/gcc/value-range.cc > @@ -324,6 +324,14 @@ frange::set (tree type, > m_neg_nan = false; > } > > + if (!HONOR_SIGNED_ZEROS (m_type)) > + { > + if (real_iszero (&m_min, 1)) > + m_min.sign = 0; > + if (real_iszero (&m_max, 1)) > + m_max.sign = 0; > + } > + > // For -ffinite-math-only we can drop ranges outside the > // representable numbers to min/max for the type. > if (flag_finite_math_only) > -- > 2.37.3 Jakub