public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Aldy Hernandez <aldyh@redhat.com>
Cc: GCC patches <gcc-patches@gcc.gnu.org>,
	Andrew MacLeod <amacleod@redhat.com>
Subject: Re: [PATCH] Decimal floats can never be an frange::singleton_p.
Date: Mon, 5 Sep 2022 15:51:25 +0200	[thread overview]
Message-ID: <YxX+3Vv+S7cqGmJR@tucnak> (raw)
In-Reply-To: <20220905134701.3330685-1-aldyh@redhat.com>

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


  reply	other threads:[~2022-09-05 13:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-05 13:47 Aldy Hernandez
2022-09-05 13:51 ` Jakub Jelinek [this message]
2022-09-05 15:55 ` Aldy Hernandez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YxX+3Vv+S7cqGmJR@tucnak \
    --to=jakub@redhat.com \
    --cc=aldyh@redhat.com \
    --cc=amacleod@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).