From: Richard Biener <richard.guenther@gmail.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: HAO CHEN GUI <guihaoc@linux.ibm.com>,
gcc-patches <gcc-patches@gcc.gnu.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 19:46:07 +0100 [thread overview]
Message-ID: <CAFiYyc18tY-0iV9=nZxoLmahK7gEGHqt1Ki0qws+m9sBhtwyVA@mail.gmail.com> (raw)
In-Reply-To: <20221128175629.GO25951@gate.crashing.org>
On Mon, Nov 28, 2022 at 6:58 PM Segher Boessenkool
<segher@kernel.crashing.org> wrote:
>
> On Mon, Nov 28, 2022 at 09:42:05AM +0100, Richard Biener wrote:
> > 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.
>
> Hi!
>
> cbranchcc4 is *not* a compare-and-branch, like ccbranch<mode>4 for other
> modes are. Instead, it is a conditional branch. I still think it is a
> bad idea to use this same pattern name for a completely different (and
> much more basic) concept, it just confuses many things, makes us need
> exceptions in most users of cbranch<mode>4 :-(
>
> cbranchcc4 does not do a comparison. Instead, it uses the result of
> some previous comparison in some CC register (or anything else that set
> such a register). We want to use a cbranchcc4 to reuse some earlier
> comparison here. Which is great of course! But, redoing the
> (potentially expensive) computation to prepare the CC for a more
> complicated condition is not a good idea. Also, Power's conditional
> branch insns just branch on one of the 32 condition bits (either set or
> unset), not on a logical combination of multiple of those bits, as we
> need with LTGT, UNLT, UNGT, UNEQ, and LE and GE without fastmath. So it
> is much cleaner (and causes fewer problems later on) if we only allow
> those codes we do support.
>
> Example of LTGT:
> fcmpu 0,0,1 # compare f0 <=> f1 to cr0 (exactly one of
> # cr0.lt, cr0.gt, cr0.eq, cr0.un will be set)
> cror 2,0,1 # cr0.eq = cr0.lt | cr0.gt
> beq 0 # branch if cr0.eq is set
>
> So, we want the cbranchcc4 here to just do that last insn, not the last
> two insns (or all three as any other cbranch<mode>4 is!)
Anyhow - my question still stands - what's the fallback for the callers
that do not check for failure? How are we sure we're not running into
these when relaxing the requirement that a MODE_CC prepare_cmp_insn
must not fail?
Richard.
>
> Segher
next prev parent reply other threads:[~2022-11-28 18:46 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
2022-11-28 17:56 ` Segher Boessenkool
2022-11-28 18:46 ` Richard Biener [this message]
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='CAFiYyc18tY-0iV9=nZxoLmahK7gEGHqt1Ki0qws+m9sBhtwyVA@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).