public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Pinski <pinskia@gmail.com>
To: Krister Walfridsson <krister.walfridsson@gmail.com>
Cc: Richard Biener <richard.guenther@gmail.com>,
	Michael Matz <matz@suse.de>,
	gcc@gcc.gnu.org
Subject: Re: types in GIMPLE IR
Date: Thu, 29 Jun 2023 12:32:13 -0700	[thread overview]
Message-ID: <CA+=Sn1mtY5xUzoTrZjKWmGXzsigYX_dpLqVAxoktjRmoPZhSpQ@mail.gmail.com> (raw)
In-Reply-To: <Pine.NEB.4.64.2306291850300.24594@gateway.kwa>

On Thu, Jun 29, 2023 at 12:10 PM Krister Walfridsson via Gcc
<gcc@gcc.gnu.org> wrote:
>
> On Thu, 29 Jun 2023, Richard Biener wrote:
>
> > IIRC we have some simplification rules that turn bit operations into
> > arithmetics.  Arithmetic is allowed if it keeps the values inside
> > [-1,0] for signed bools or [0, 1] for unsigned bools.
> >
> >> I have now verified that all cases seems to be just one operation of this
> >> form (where _127 has the value 0 or 1), so it cannot construct values
> >> such as 42. But the wide signed Boolean can have the three different
> >> values 1, 0, and -1, which I still think is at least one too many. :)
> >
> > Yeah, I'd be interested in a testcase that shows this behavior.
>
> I created PR 110487 with one example.
>
>
> >> I'll update my tool to complain if the value is outside the range [-1, 1].
>
> It is likely that all issues I have seen so far are due to PR 110487, so
> I'll keep the current behavior that complains if the value is outside the
> range [-1, 0].

Yes there are many similar to this all over GCC's folding.
In this case checking TYPE_PRECISION as described in the match.pd is
not even the right approach.
The whole TYPE_PRECISION on boolean types is definitely a big can of worms.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102622 is related but
that was signed boolean:1.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106053 is another related case.

For this weekend, I am going to audit some of the match patterns for
these issues.


>
>     /Krister

      reply	other threads:[~2023-06-29 19:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-28  9:15 Krister Walfridsson
2023-06-28 15:46 ` Michael Matz
2023-06-29  6:21   ` Richard Biener
2023-06-29 12:06     ` Krister Walfridsson
2023-06-29 12:24       ` Michael Matz
2023-06-29 13:19       ` Richard Biener
2023-06-29 19:08         ` Krister Walfridsson
2023-06-29 19:32           ` Andrew Pinski [this message]

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='CA+=Sn1mtY5xUzoTrZjKWmGXzsigYX_dpLqVAxoktjRmoPZhSpQ@mail.gmail.com' \
    --to=pinskia@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=krister.walfridsson@gmail.com \
    --cc=matz@suse.de \
    --cc=richard.guenther@gmail.com \
    /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).