public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: Jakub Jelinek <jakub@redhat.com>
Cc: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com
Subject: Re: [PATCH] middle-end/114070 - VEC_COND_EXPR folding
Date: Fri, 1 Mar 2024 13:11:18 +0100 (CET)	[thread overview]
Message-ID: <q7524438-nq0q-58r1-rnq0-3qs6ps7s379r@fhfr.qr> (raw)
In-Reply-To: <ZeBf8Z1WeYCKq7un@tucnak>

On Thu, 29 Feb 2024, Jakub Jelinek wrote:

> On Thu, Feb 29, 2024 at 11:16:54AM +0100, Richard Biener wrote:
> > That said, the quick experiment shows this isn't anything for stage4.
> 
> The earlier the vector lowering is moved in the pass list, the higher
> are the possibilities that match.pd or some other optimization reintroduces
> unsupportable vector operations into the IL.
> 
> Guess your patch looks reasonable.

Pushed.

Thanks,
Richard.

> > > 	PR middle-end/114070
> > > 	* match.pd ((c ? a : b) op d  -->  c ? (a op d) : (b op d)):
> > > 	Allow the folding if before lowering and the current IL
> > > 	isn't supported with vcond_mask.
> > > ---
> > >  gcc/match.pd | 18 +++++++++++++++---
> > >  1 file changed, 15 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/gcc/match.pd b/gcc/match.pd
> > > index f3fffd8dec2..4edba7c84fb 100644
> > > --- a/gcc/match.pd
> > > +++ b/gcc/match.pd
> > > @@ -5153,7 +5153,13 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
> > >    (op (vec_cond:s @0 @1 @2) (vec_cond:s @0 @3 @4))
> > >    (if (TREE_CODE_CLASS (op) != tcc_comparison
> > >         || types_match (type, TREE_TYPE (@1))
> > > -       || expand_vec_cond_expr_p (type, TREE_TYPE (@0), ERROR_MARK))
> > > +       || expand_vec_cond_expr_p (type, TREE_TYPE (@0), ERROR_MARK)
> > > +       || (optimize_vectors_before_lowering_p ()
> > > +	   /* The following is optimistic on the side of non-support, we are
> > > +	      missing the legacy vcond{,u,eq} cases.  Do this only when
> > > +	      lowering will be able to fixup..  */
> > > +	   && !expand_vec_cond_expr_p (TREE_TYPE (@1),
> > > +				       TREE_TYPE (@0), ERROR_MARK)))
> > >     (vec_cond @0 (op! @1 @3) (op! @2 @4))))
> > >  
> > >  /* (c ? a : b) op d  -->  c ? (a op d) : (b op d) */
> > > @@ -5161,13 +5167,19 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
> > >    (op (vec_cond:s @0 @1 @2) @3)
> > >    (if (TREE_CODE_CLASS (op) != tcc_comparison
> > >         || types_match (type, TREE_TYPE (@1))
> > > -       || expand_vec_cond_expr_p (type, TREE_TYPE (@0), ERROR_MARK))
> > > +       || expand_vec_cond_expr_p (type, TREE_TYPE (@0), ERROR_MARK)
> > > +       || (optimize_vectors_before_lowering_p ()
> > > +	   && !expand_vec_cond_expr_p (TREE_TYPE (@1),
> > > +				       TREE_TYPE (@0), ERROR_MARK)))
> > >     (vec_cond @0 (op! @1 @3) (op! @2 @3))))
> > >   (simplify
> > >    (op @3 (vec_cond:s @0 @1 @2))
> > >    (if (TREE_CODE_CLASS (op) != tcc_comparison
> > >         || types_match (type, TREE_TYPE (@1))
> > > -       || expand_vec_cond_expr_p (type, TREE_TYPE (@0), ERROR_MARK))
> > > +       || expand_vec_cond_expr_p (type, TREE_TYPE (@0), ERROR_MARK)
> > > +       || (optimize_vectors_before_lowering_p ()
> > > +	   && !expand_vec_cond_expr_p (TREE_TYPE (@1),
> > > +				       TREE_TYPE (@0), ERROR_MARK)))
> > >     (vec_cond @0 (op! @3 @1) (op! @3 @2)))))
> > >  
> > >  #if GIMPLE
> > > 
> 
> 	Jakub
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)

  reply	other threads:[~2024-03-01 12:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-29 10:16 Richard Biener
2024-02-29 10:44 ` Jakub Jelinek
2024-03-01 12:11   ` Richard Biener [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-02-29  8:35 Richard Biener
2024-03-03 17:02 ` Jeff Law

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=q7524438-nq0q-58r1-rnq0-3qs6ps7s379r@fhfr.qr \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --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).