public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: will_schmidt@vnet.ibm.com,
		"William J. Schmidt" <wschmidt@linux.vnet.ibm.com>,
	David Edelsohn <dje.gcc@gmail.com>,
		GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH, rs6000] Early gimple folding of vec_mergeh and vec_mergel for float
Date: Fri, 17 Aug 2018 14:01:00 -0000	[thread overview]
Message-ID: <CAFiYyc2Oubdu7pkLS-u5mHU9zGL92YxFDHpkTC5T8o322qKoiw@mail.gmail.com> (raw)
In-Reply-To: <20180807225936.GJ31204@gate.crashing.org>

On Wed, Aug 8, 2018 at 12:59 AM Segher Boessenkool
<segher@kernel.crashing.org> wrote:
>
> Hi!
>
> On Tue, Aug 07, 2018 at 02:24:58PM -0500, Will Schmidt wrote:
> >    This adds support for gimple folding of vec_mergeh and vec_mergel
> > for float and double types.   Support for the integral types is already
> > in-tree.
>
> > +  /* The permute_type will match the lhs for integral types.  For double and
> > +     float types, the permute type needs to map to the V2 or V4 type that
> > +     matches size.  */
> > +  tree permute_type;
> > +  if (INTEGRAL_TYPE_P (TREE_TYPE (lhs_type)))
> > +    permute_type = lhs_type;
> > +  else
> > +    if (TREE_TYPE (lhs_type) == TREE_TYPE (V2DF_type_node))
> > +      permute_type = V2DI_type_node;
> > +    else if (TREE_TYPE (lhs_type) == TREE_TYPE (V4SF_type_node))
> > +      permute_type = V4SI_type_node;
> > +    else
> > +      gcc_unreachable ();
>
> Please write this as
>
>   if (INTEGRAL_TYPE_P (TREE_TYPE (lhs_type)))
>     permute_type = lhs_type;
>   else if (TREE_TYPE (lhs_type) == TREE_TYPE (V2DF_type_node))
>     permute_type = V2DI_type_node;
>   else if (TREE_TYPE (lhs_type) == TREE_TYPE (V4SF_type_node))
>     permute_type = V4SI_type_node;
>   else
>     gcc_unreachable ();
>
> or, if you want to emphasize integer vs. float:
>
>   if (INTEGRAL_TYPE_P (TREE_TYPE (lhs_type)))
>     permute_type = lhs_type;
>   else
>     {
>       if (TREE_TYPE (lhs_type) == TREE_TYPE (V2DF_type_node))

Are you sure lhs_type is never qualified?  That is, for a GIMPLE folder
I'd have expected

  if (types_compatible_p (TREE_TYPE (lhs_type), TREE_TYPE (V2DF_type_node)))

for GENERIC

  if (TYPE_MAIN_VARIANT (TREE_TYPE (lhs_type)) == TREE_TYPE (V2DF_type_node))

Richard.

>         permute_type = V2DI_type_node;
>       else if (TREE_TYPE (lhs_type) == TREE_TYPE (V4SF_type_node))
>         permute_type = V4SI_type_node;
>       else
>         gcc_unreachable ();
>     }
>
> Okay for trunk with that changed.  Thanks!
>
>
> Segher

  reply	other threads:[~2018-08-17 14:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-07 19:25 Will Schmidt
2018-08-07 22:59 ` Segher Boessenkool
2018-08-17 14:01   ` Richard Biener [this message]
2018-08-17 15:05     ` Will Schmidt
2018-08-17 15:16       ` Richard Biener
2018-08-20 21:40         ` [PATCH, rs6000] Improve TREE_TYPE comparisons in fold_mergehl_helper() Will Schmidt
2018-08-20 22:07           ` Segher Boessenkool
2018-08-21  8:10             ` 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=CAFiYyc2Oubdu7pkLS-u5mHU9zGL92YxFDHpkTC5T8o322qKoiw@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=segher@kernel.crashing.org \
    --cc=will_schmidt@vnet.ibm.com \
    --cc=wschmidt@linux.vnet.ibm.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).