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 5A6593857017 for ; Mon, 5 Sep 2022 13:51:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5A6593857017 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=1662385891; 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=9Vk8LB7ziIt+k7dl2nWhQPsL1xymwc72mu0kz33C4kg=; b=DXlqRc7h04CsU2SnyrT7SOQHVx/6fihp33iNozu/8L9vvTNpg+3D9dQvc2cOYfhCL0guBf KdAaTpwCB7sLFn+s0Ld6lm12fHKsLP72G9nWLKKNqT/GltUmfNmBvImOCYxQ7hOq4670gH oonIbpnsNl3hyl8mCpQxLn+B5620Fc4= 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-103-5mWj13yoNTGo8ZAnIZkx4A-1; Mon, 05 Sep 2022 09:51:30 -0400 X-MC-Unique: 5mWj13yoNTGo8ZAnIZkx4A-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3DB8C85A589 for ; Mon, 5 Sep 2022 13:51:30 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E8BE81121319; Mon, 5 Sep 2022 13:51:29 +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 285DpRdI108552 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 5 Sep 2022 15:51:27 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 285DpPTM108551; Mon, 5 Sep 2022 15:51:25 +0200 Date: Mon, 5 Sep 2022 15:51:25 +0200 From: Jakub Jelinek To: Aldy Hernandez Cc: GCC patches , Andrew MacLeod Subject: Re: [PATCH] Decimal floats can never be an frange::singleton_p. Message-ID: Reply-To: Jakub Jelinek References: <20220905134701.3330685-1-aldyh@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220905134701.3330685-1-aldyh@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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=-10.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,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, Sep 05, 2022 at 03:47:01PM +0200, Aldy Hernandez wrote: > As Jakub mentioned in the PR, because many numbers have multiple > possible representations, we can't reliably return true here. > > I'll commit this if tests pass. > > I wonder if its worth even handling decimal floats in frange, since > there's a lot of things we can't represent. I suppose even though we > could never propagate an actual value with VRP, we could fold > conditionals (symbolic and stuff outside ranges, etc) ??. > > Thoughts? > > PR middle-end/106831 > > gcc/ChangeLog: > > * value-range.cc (frange::singleton_p): Return false for > DECIMAL_FLOAT_TYPE_P. > --- > gcc/value-range.cc | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/gcc/value-range.cc b/gcc/value-range.cc > index c3f668a811a..12a3750d078 100644 > --- a/gcc/value-range.cc > +++ b/gcc/value-range.cc > @@ -647,6 +647,14 @@ frange::singleton_p (tree *result) const > if (HONOR_NANS (m_type) && !get_nan ().no_p ()) > return false; > > + // Because the significand is not normalized (there is no > + // implicit leading "1"). Most values with less than 7 > + // significant digits have multiple possible representations. > + // Zero has 192 possible representations (or twice that for > + // signed zeros). The exact details (7, 192) are dependent on the format, for decimal64 it is (16, 768) and for decimal128 (34, 12288). Jakub