public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Uros Bizjak <ubizjak@gmail.com>
Cc: Richard Biener <rguenther@suse.de>,
	"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	Jeff Law <jeffreyalaw@gmail.com>
Subject: Re: [PATCH v2] combine: Fix ICE in try_combine on pr112494.c [PR112560]
Date: Thu, 7 Mar 2024 16:27:11 -0600	[thread overview]
Message-ID: <20240307222711.GP19790@gate.crashing.org> (raw)
In-Reply-To: <CAFULd4ax3Op6jZ=XiRZz-ZAmzt+URZfvdXbz_zLBE94Bb0mquw@mail.gmail.com>

On Thu, Mar 07, 2024 at 11:07:18PM +0100, Uros Bizjak wrote:
> On Thu, Mar 7, 2024 at 10:37 PM Segher Boessenkool
> <segher@kernel.crashing.org> wrote:
> > > but can be something else, such as the above noted
> > >
> > >  (unspec:DI [
> > >          (reg:CC 17 flags)
> > >      ] UNSPEC_PUSHFL)
> >
> > But that is invalid RTL?  The only valid use of a CC is written as
> > cc-compared-to-0.  It means "the result of something compared to 0,
> > stored in that cc reg".
> >
> > (And you can copy a CC reg around, but that is not a use ;-) )
> 
> How can we describe a pushfl then?

(unspec:DI [
        (compare:CC) ((reg:CC 17 flags) (const_int 0))
    ] UNSPEC_PUSHFL)

or something like that?

> It was changed to its current form
> in [1], but I suspect that the code will try to update it even when
> pushfl is implemented as a direct move from a register (as was defined
> previously).
> 
> BTW: Unspecs are used in a couple of other places for other targets [2].
> 
> [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112494#c5
> [2] https://gcc.gnu.org/pipermail/gcc-patches/2023-December/639743.html

There is nothing wront with unspecs.  You cannot use a CCmode value
without comparing it to 0, though.  The exact kind of comparison
determines what bits are valid (and have what meaning) in your CC reg,
even!

> > > The source code that deals with the *user* of the CC register assumes
> > > the former form, so it blindly tries to update the mode of the CC
> > > register inside LT comparison RTX
> >
> > Would you like it better if there was an assert for this?  There are
> > very many RTL requirements that aren't chacked for currently :-/
> 
> In this case - yes. Assert signals that something is unsupported (or
> invalid), way better than silently corrupting some memory, reporting
> the corruption only with checking enabled.

Yeah.  The way RTL checking works makes this hard to do in most cases.
Hrm.  (It cannot easily look at context, only inside of the current RTX).

> > The unspec should have the CC compared with 0 as argument.
> 
> But this does not do what pushfl does... It pushes the register to the stack.

Can't you just describe the dataflow then, without an unspec?  An unspec
by definition does some (unspecified) operation on the data.


Segher

  reply	other threads:[~2024-03-07 22:28 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-07  9:16 Uros Bizjak
2024-03-07  9:55 ` Richard Biener
2024-03-07 10:11   ` Uros Bizjak
2024-03-07 10:22     ` Richard Biener
2024-03-07 17:44       ` Segher Boessenkool
2024-03-07 10:37     ` Jakub Jelinek
2024-03-07 10:45       ` Richard Biener
2024-03-07 11:22         ` Uros Bizjak
2024-03-07 17:51           ` Segher Boessenkool
2024-03-07 17:49         ` Segher Boessenkool
2024-03-07 10:57       ` Uros Bizjak
2024-03-07 17:36   ` Segher Boessenkool
2024-03-07 21:04     ` Uros Bizjak
2024-03-07 21:08       ` Uros Bizjak
2024-03-07 21:35       ` Segher Boessenkool
2024-03-07 22:07         ` Uros Bizjak
2024-03-07 22:27           ` Segher Boessenkool [this message]
2024-03-07 22:46             ` Uros Bizjak
2024-03-18 14:49               ` Segher Boessenkool
2024-03-18 15:44                 ` Uros Bizjak
2024-03-07 22:27           ` Uros Bizjak
2024-03-18 14:44             ` Segher Boessenkool
2024-03-18 15:29               ` Uros Bizjak

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=20240307222711.GP19790@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=rguenther@suse.de \
    --cc=ubizjak@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).