public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: "Liu, Hongtao" <hongtao.liu@intel.com>
Cc: Richard Biener <richard.guenther@gmail.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Canonicalize (vec_duplicate (not A)) to (not (vec_duplicate A)).
Date: Thu, 3 Jun 2021 14:59:33 -0500	[thread overview]
Message-ID: <20210603195933.GW18427@gate.crashing.org> (raw)
In-Reply-To: <CY4PR11MB2007083223D73249A34A3777E53C9@CY4PR11MB2007.namprd11.prod.outlook.com>

On Thu, Jun 03, 2021 at 11:03:43AM +0000, Liu, Hongtao wrote:
> >A very typical example is how UMIN is optimised:
> >
> >   case UMIN:
> >      if (trueop1 == CONST0_RTX (mode) && ! side_effects_p (op0))
> >	return op1;
> >      if (rtx_equal_p (trueop0, trueop1) && ! side_effects_p (op0))
> >	return op0;
> >      tem = simplify_associative_operation (code, mode, op0, op1);
> >      if (tem)
> >	return tem;
> >      break;
> >
> >(the stuff using "tem").
> >
> >Hongtao, can we do something similar here?  Does that work well?  Please try
> >it out :-)
> 
> In simplify_rtx, no simplication occurs, there is just the difference between
>  (vec_duplicate (not REG)) and (not (vec_duplicate (REG)). So here tem will only be 0.

simplify-rtx is used by combine.  When you do and+not+splat for example
my suggestion should kick in.  Try it out, don't just dismiss it?

> Basically we don't know it's a simplication until combine successfully split the
> 3->2 instructions (not + broadcast + and to andnot + broadcast), but it's pretty awkward
> to do this in combine.

But you need to do this *before* it is split.  That is the whole point.

> Consider andnot is existed for many backends, I think a canonicalization is needed here.

Please do note that that is not as easy as yoou may think: you need to
make sure nothing ever creates non-canonical code.

> Maybe we can add insn canonicalization for transforming (and (vect_duplicate (not A)) B) to 
> (and (not (duplicate (not A)) B) instead of (vec_duplicate (not A)) to (not (vec_duplicate A))?

I don't understand what this means?


Segher

  parent reply	other threads:[~2021-06-03 20:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-25  5:49 [PATCH][i386] Split not+broadcast+pand to broadcast+pandn Hongtao Liu
2021-05-25  6:11 ` Andrew Pinski
2021-05-25  6:23   ` Hongtao Liu
2021-05-25  6:29     ` Andrew Pinski
2021-05-25  6:34       ` Hongtao Liu
2021-05-26  1:21         ` Hongtao Liu
2021-05-26  4:12           ` Andrew Pinski
2021-05-26  5:17             ` Hongtao Liu
2021-06-01  8:32               ` Hongtao Liu
2021-06-01 13:54                 ` Segher Boessenkool
2021-06-01 14:02                 ` Segher Boessenkool
2021-06-02  5:39                   ` liuhongt
2021-06-02  5:39                     ` [PATCH] Canonicalize (vec_duplicate (not A)) to (not (vec_duplicate A)) liuhongt
2021-06-02  7:07                       ` Richard Biener
2021-06-02 20:46                         ` Segher Boessenkool
2021-06-03 11:03                           ` Liu, Hongtao
2021-06-03 11:06                             ` Jakub Jelinek
2021-06-03 19:59                             ` Segher Boessenkool [this message]
2021-06-04  2:48                               ` Liu, Hongtao
2021-06-02  5:49                     ` Hongtao Liu
2021-06-02  5:41                   ` [PATCH] Canonicalize (vec_duplicate (not A)) to (not (vec_duplicate A)) liuhongt

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=20210603195933.GW18427@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hongtao.liu@intel.com \
    --cc=richard.guenther@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).