public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: HAO CHEN GUI <guihaoc@linux.ibm.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>,
	 Segher Boessenkool <segher@kernel.crashing.org>,
	David <dje.gcc@gmail.com>,  Peter Bergner <bergner@linux.ibm.com>,
	"Kewen.Lin" <linkw@linux.ibm.com>
Subject: Re: Ping [PATCH] Change the behavior of predicate check failure on cbranchcc4 operand0 in prepare_cmp_insn
Date: Mon, 28 Nov 2022 09:42:05 +0100	[thread overview]
Message-ID: <CAFiYyc01077Sqjv-Z7DCxo8ydNAguuS3yAFsqqmz2LwkFHNCxg@mail.gmail.com> (raw)
In-Reply-To: <d60458f2-7bef-cbb5-c4c6-1ebf03539ceb@linux.ibm.com>

On Mon, Nov 28, 2022 at 6:33 AM HAO CHEN GUI via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Hi,
>    Gentle ping this:
> https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607083.html
> Thanks
> Gui Haochen
>
> 在 2022/11/23 10:54, HAO CHEN GUI 写道:
> > Hi,
> >   I want to enable "have_cbranchcc4" on rs6000. But not all combinations of
> > comparison codes and sub CC modes are benefited to generate cbranchcc4 insns
> > on rs6000. There is an predicate for operand0 of cbranchcc4 to bypass
> > some combinations. It gets assertion failure in prepare_cmp_insn. I think
> > we shouldn't suppose that all comparison codes and sub CC modes are supported
> > and throw an assertion failure in prepare_cmp_insn. It might check the
> > predicate and go to fail if the predicate can't be satisfied. This patch
> > changes the behavior of those codes.
> >
> >   Bootstrapped and tested on powerpc64-linux BE/LE and x86 with no regressions.
> > Is this okay for trunk? Any recommendations? Thanks a lot.

Since the function seems to be allowed to fail the patch looks
reasonable - still I wonder
what the "fallback" for a MODE_CC style compare-and-branch is?  There
are callers
of this function that do not seem to expect failure at least, some
suspiciously looking
like MODE_CC candiates.

Richard.

> >
> >
> > ChangeLog
> > 2022-11-23  Haochen Gui <guihaoc@linux.ibm.com>
> >
> > gcc/
> >       * optabs.cc (prepare_cmp_insn): Go to fail other than assert it when
> >       predicate check of "cbranchcc4" operand[0] fails.
> >
> > patch.diff
> > diff --git a/gcc/optabs.cc b/gcc/optabs.cc
> > index 165f8d1fa22..3ec8f6b17ba 100644
> > --- a/gcc/optabs.cc
> > +++ b/gcc/optabs.cc
> > @@ -4484,8 +4484,9 @@ prepare_cmp_insn (rtx x, rtx y, enum rtx_code comparison, rtx size,
> >      {
> >        enum insn_code icode = optab_handler (cbranch_optab, CCmode);
> >        test = gen_rtx_fmt_ee (comparison, VOIDmode, x, y);
> > -      gcc_assert (icode != CODE_FOR_nothing
> > -                  && insn_operand_matches (icode, 0, test));
> > +      gcc_assert (icode != CODE_FOR_nothing);
> > +      if (!insn_operand_matches (icode, 0, test))
> > +     goto fail;
> >        *ptest = test;
> >        return;
> >      }

  reply	other threads:[~2022-11-28  8:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23  2:54 HAO CHEN GUI
2022-11-28  5:32 ` Ping " HAO CHEN GUI
2022-11-28  8:42   ` Richard Biener [this message]
2022-11-28 17:56     ` Segher Boessenkool
2022-11-28 18:46       ` Richard Biener
2022-11-28 23:02         ` Segher Boessenkool
2022-11-29  1:15         ` HAO CHEN GUI
2022-11-29  8:26           ` Richard Biener
2022-11-28  6:16 ` Kewen.Lin

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=CAFiYyc01077Sqjv-Z7DCxo8ydNAguuS3yAFsqqmz2LwkFHNCxg@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=bergner@linux.ibm.com \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=guihaoc@linux.ibm.com \
    --cc=linkw@linux.ibm.com \
    --cc=segher@kernel.crashing.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).