public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Richard Sandiford <richard.sandiford@arm.com>
Cc: "Martin Liška" <mliska@suse.cz>, "GCC Patches" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH][RFC] Come up with VEC_COND_OP_EXPRs.
Date: Tue, 24 Sep 2019 11:29:00 -0000	[thread overview]
Message-ID: <CAFiYyc0GK7z5LFjgFZOXLgV1cj4qnrtm3nw9nN0u0ypye53sdQ@mail.gmail.com> (raw)
In-Reply-To: <mptimpilziv.fsf@arm.com>

On Tue, Sep 24, 2019 at 1:11 PM Richard Sandiford
<richard.sandiford@arm.com> wrote:
>
> Martin Liška <mliska@suse.cz> writes:
> > Hi.
> >
> > The patch introduces couple of new TREE_CODEs that will help us to have
> > a proper GIMPLE representation of current VECT_COND_EXPR. Right now,
> > the first argument is typically a GENERIC tcc_expression tree with 2 operands
> > that are visited at various places in GIMPLE code. That said, based on the discussion
> > with Richi, I'm suggesting to come up with e.g.
> > VECT_COND_LT_EXPR<COND_LHS, COND_RHS, IF_CLAUSE, ELSE_CLAUSE>. Such a change logically
> > introduces new GIMPLE_QUATERNARY_RHS gassignments. For now, the VEC_COND_EXPR remains
> > and is only valid in GENERIC and gimplifier will take care of the corresponding transition.
> >
> > The patch is a prototype and missing bits are:
> > - folding support addition for GIMPLE_QUATERNARY_RHS is missing
> > - fancy tcc_comparison expressions like LTGT_EXPR, UNORDERED_EXPR, ORDERED_EXPR,
> >   UNLT_EXPR and others are not supported right now
> > - comments are missing for various functions added
> >
> > Apart from that I was able to bootstrap and run tests with a quite small fallout.
> > Thoughts?
> > Martin
>
> I think this is going in the wrong direction.  There are some targets
> that can only handle VEC_COND_EXPRs well if we know the associated
> condition, and others where a compare-and-VEC_COND_EXPR will always be
> two operations.  In that situation, it seems like the native gimple
> representation should be the simpler representation rather than the
> more complex one.  That way the comparisons can be optimised
> independently of any VEC_COND_EXPRs on targets that benefit from that.
>
> So IMO it would be better to use three-operand VEC_COND_EXPRs with
> no embedded conditions as the preferred gimple representation and
> have internal functions for the fused operations that some targets
> prefer.  This means that using fused operations is "just" an instruction
> selection decision rather than hard-coded throughout gimple.  (And that
> fits in well with the idea of doing more instruction selection in gimple.)

So I've been doing that before, but more generally also for COND_EXPR.
We cannot rely on TER and the existing RTL expansion "magic" for the
instruction selection issue you mention because TER isn't reliable.  With
IFNs for optabs we could do actual [vector] condition instruction selection
before RTL expansion, ignoring "single-use" issues - is that what you are
hinting at?  How should the vectorizer deal with this?  Should it directly
use the optab IFNs then when facing "split" COND_EXPRs?  IIRC the
most fallout of a simple patch (adjusting is_gimple_condexpr) is in the
vectorizer.

Note I'm specifically looking for a solution that applies to both COND_EXPR
and VEC_COND_EXPR since both suffer from the same issues.

There was also recent work in putting back possibly trapping comparisons
into [VEC_]COND_EXPR because it doesn't interfere with EH and allows
better code.  Also you SVE people had VN issues with cond-exprs and
VN runs into the exact same issue (but would handle separate comparisons
better - with the caveat of breaking TER).

Richard.

>
> Thanks,
> Richard

  reply	other threads:[~2019-09-24 11:29 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-24 10:25 Martin Liška
2019-09-24 11:11 ` Richard Sandiford
2019-09-24 11:29   ` Richard Biener [this message]
2019-09-24 11:57     ` Richard Sandiford
2019-09-24 12:18       ` Richard Biener
2019-09-24 14:51         ` Richard Sandiford
2020-04-01 10:19 ` [stage1][PATCH] Lower VEC_COND_EXPR into internal functions Martin Liška
2020-04-06  9:17   ` Richard Sandiford
2020-04-06 12:30     ` Richard Biener
2020-05-21 12:51       ` Martin Liška
2020-05-21 13:29         ` Martin Liška
2020-05-21 20:16           ` Segher Boessenkool
2020-05-22 11:14             ` Richard Biener
2020-05-26 10:15               ` Richard Sandiford
2020-05-27 14:04                 ` Martin Liška
2020-05-27 16:13                   ` Richard Sandiford
2020-05-27 16:32                     ` Richard Biener
2020-05-28 14:46                       ` Martin Liška
2020-05-28 15:28                         ` Richard Sandiford
2020-05-29 12:17                           ` Richard Biener
2020-05-29 12:43                             ` Richard Biener
2020-05-29 16:47                               ` Segher Boessenkool
2020-05-29 17:05                                 ` Richard Sandiford
2020-05-29 17:30                                   ` Segher Boessenkool
2020-05-29 15:39                             ` Segher Boessenkool
2020-05-29 16:57                               ` Richard Sandiford
2020-05-29 17:09                                 ` Segher Boessenkool
2020-05-29 17:26                                   ` Richard Sandiford
2020-05-29 17:37                                     ` Segher Boessenkool
2020-05-30  7:15                                       ` Richard Sandiford
2020-05-30 13:08                                         ` Segher Boessenkool
2020-06-02 11:09                                           ` Richard Biener
2020-06-02 15:00                                             ` Martin Liška
2020-06-03  7:38                                               ` Richard Biener
2020-06-03 13:41                                                 ` Richard Sandiford
2020-06-03 14:17                                                   ` David Edelsohn
2020-06-03 14:46                                                     ` Richard Biener
2020-06-03 17:01                                                       ` Segher Boessenkool
2020-06-03 17:23                                                         ` Richard Biener
2020-06-03 18:23                                                           ` Segher Boessenkool
2020-06-03 18:38                                                             ` Richard Biener
2020-06-03 18:46                                                               ` David Edelsohn
2020-06-03 19:09                                                               ` Segher Boessenkool
2020-06-03 19:13                                                                 ` Jakub Jelinek
2020-06-03 18:27                                               ` Segher Boessenkool
2020-06-08 11:04                                                 ` Martin Liška
2020-06-09 13:42                                                   ` Richard Biener
2020-06-10  8:51                                                     ` Martin Liška
2020-06-10 10:50                                                       ` Richard Biener
2020-06-10 12:27                                                         ` Martin Liška
2020-06-10 13:01                                                           ` Martin Liška
2020-06-11  8:52                                                     ` Martin Liška
2020-06-12  9:43                                                       ` Richard Biener
2020-06-12 13:24                                                         ` Martin Liška
2020-06-15  7:14                                                           ` Richard Biener
2020-06-15 11:19                                                             ` Martin Liška
2020-06-15 11:59                                                               ` Richard Biener
2020-06-15 12:20                                                                 ` Martin Liška
2020-06-17  8:50                                                                   ` Richard Biener
2020-06-17 13:15                                                                     ` Richard Biener
2020-06-18  8:10                                                                       ` Martin Liška
2020-06-18  8:52                                                                         ` Richard Biener
2020-06-18  9:02                                                                           ` Martin Liška
2020-06-18  9:29                                                                             ` Martin Liška
2020-04-06 12:33     ` Richard Biener

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=CAFiYyc0GK7z5LFjgFZOXLgV1cj4qnrtm3nw9nN0u0ypye53sdQ@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mliska@suse.cz \
    --cc=richard.sandiford@arm.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).