public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	Uros Bizjak <ubizjak@gmail.com>,
	 Jakub Jelinek <jakub@redhat.com>,
	Richard Sandiford <richard.sandiford@arm.com>
Subject: Re: [PATCH v2 1/2] Allow vec_duplicate_optab to fail
Date: Mon, 7 Jun 2021 19:59:55 +0200	[thread overview]
Message-ID: <CAFiYyc1Lu3TLG5tf2Cz+vnX3s-ujoJe400kjFHKuCGACD=bdsQ@mail.gmail.com> (raw)
In-Reply-To: <CAMe9rOrVNaEvvvD=4pR3QtFx44sWhgnKgHMoc83eaaf2xkv-DA@mail.gmail.com>

On Mon, Jun 7, 2021 at 4:19 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Mon, Jun 7, 2021 at 12:12 AM Richard Sandiford
> <richard.sandiford@arm.com> wrote:
> >
> > "H.J. Lu" <hjl.tools@gmail.com> writes:
> > > Update vec_duplicate to allow to fail so that backend can only allow
> > > broadcasting an integer constant to a vector when broadcast instruction
> > > is available.
> >
> > I'm not sure why we need this to fail though.  Once the optab is defined
> > for target X, the optab should handle all duplicates for target X,
> > even if there are different strategies it can use.
> >
> > AIUI the case you want to make conditional is the constant case.
> > I guess the first question is: why don't we simplify those CONSTRUCTORs
> > to VECTOR_CSTs in gimple?  I'm surprised we still see the constant case
> > as a constructor here.
>
> The particular testcase for vec_duplicate is gcc.dg/pr100239.c.
>
> > If we can't rely on that happening, then would it work to change:
> >
> >         /* Try using vec_duplicate_optab for uniform vectors.  */
> >         if (!TREE_SIDE_EFFECTS (exp)
> >             && VECTOR_MODE_P (mode)
> >             && eltmode == GET_MODE_INNER (mode)
> >             && ((icode = optab_handler (vec_duplicate_optab, mode))
> >                 != CODE_FOR_nothing)
> >             && (elt = uniform_vector_p (exp)))
> >
> > to something like:
> >
> >         /* Try using vec_duplicate_optab for uniform vectors.  */
> >         if (!TREE_SIDE_EFFECTS (exp)
> >             && VECTOR_MODE_P (mode)
> >             && eltmode == GET_MODE_INNER (mode)
> >             && (elt = uniform_vector_p (exp)))
> >           {
> >             if (TREE_CODE (elt) == INTEGER_CST
> >                 || TREE_CODE (elt) == POLY_INT_CST
> >                 || TREE_CODE (elt) == REAL_CST
> >                 || TREE_CODE (elt) == FIXED_CST)
> >               {
> >                 rtx src = gen_const_vec_duplicate (mode, expand_normal (node));
> >                 emit_move_insn (target, src);
> >                 break;
> >               }
> >             …
> >           }
>
> I will give it a try.

I can confirm that veclower leaves us with an unfolded constant CTOR.
If you file a PR to remind me I'll fix that.

Richard.

> Thanks.
>
> --
> H.J.

  reply	other threads:[~2021-06-07 18:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-05 15:18 [PATCH v2 0/2] " H.J. Lu
2021-06-05 15:18 ` [PATCH v2 1/2] " H.J. Lu
2021-06-07  7:12   ` Richard Sandiford
2021-06-07 14:18     ` H.J. Lu
2021-06-07 17:59       ` Richard Biener [this message]
2021-06-07 18:10         ` Richard Biener
2021-06-07 20:33           ` [PATCH] middle-end/100951 - make sure to generate VECTOR_CST in lowering H.J. Lu
2021-06-09 21:03             ` Jeff Law
2021-06-09 21:31               ` H.J. Lu
2021-06-05 15:18 ` [PATCH v2 2/2] x86: Convert CONST_WIDE_INT/CONST_VECTOR to broadcast H.J. Lu

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='CAFiYyc1Lu3TLG5tf2Cz+vnX3s-ujoJe400kjFHKuCGACD=bdsQ@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=jakub@redhat.com \
    --cc=richard.sandiford@arm.com \
    --cc=ubizjak@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).