public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Thomas Preudhomme <thomas.preudhomme@foss.arm.com>
Cc: Richard Biener <rguenther@suse.de>,
	       Kyrill Tkachov <kyrylo.tkachov@foss.arm.com>,
	gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Use bswap framework in store-merging (PR tree-optimization/78821)
Date: Sun, 19 Nov 2017 18:54:00 -0000	[thread overview]
Message-ID: <20171119172608.GA14653@tucnak> (raw)
In-Reply-To: <582056e5-2f42-a323-ece9-463f848c3d1d@foss.arm.com>

On Fri, Nov 17, 2017 at 09:45:35AM +0000, Thomas Preudhomme wrote:
> > Bootstrapped/regtested on {x86_64,i686,powerpc64le,powerpc64}-linux, ok for trunk?
> > 
> > The cases this patch can handle are less common than rhs_code INTEGER_CST
> > (stores of constants to adjacent memory) or MEM_REF (adjacent memory
> > copying), but are more common than the bitwise ops, during combined
> > x86_64+i686 bootstraps/regtests it triggered:
> > lrotate_expr  974   2528
> > nop_expr  720   1711
> > (lrotate_expr stands for bswap, nop_expr for identity, the first column is
> > the actual count of such new stores, the second is the original number of
> > stores that have been optimized this way).
> 
> Are you saying that lrotate_expr is just the title and it also includes 32-
> and 64-bit bswap or is it only the count of lrotate_expr nodes?

The rhs_code field is magic shorthand, it could be perhaps also some enum,
the thing is that I need values for:
1) a constant satisfying rhs_valid_for_store_merging_p predicate
   (usually INTEGER_CST, but it can be something different).
   Right now I'm using INTEGER_CST for all those
2) a memory load; right now I'm using MEM_REF for all kinds of memory loads
3) BIT_{AND,IOR,XOR}_EXPR - these are the main reason for not using some
   specialized enums, but actually a tree_code; the advantage is that then
   there is no need to translate it in any way
4) bswap (any kind); the patch uses LROTATE_EXPR for that, again, like
   in 1) and 2) just a placeholder
5) bswap framework determined nop; the patch uses NOP_EXPR for that; a
   placeholder

Another possibility would be specialized enum, perhaps one where
SMOP_{CONSTANT,MEMORY,BSWAP,NOP} would be MAX_TREE_CODES + {1,2,3,4}
and SMOP_{AND,IOR,XOR} would be equal to BIT_{AND,IOR,XOR}_EXPR for
easier translations between.
> > @@ -1141,7 +1206,7 @@ pass_optimize_bswap::execute (function *
> >   	 inserted smaller bswap replacements as sub-patterns, the wider
> >   	 variant wouldn't be detected.  */
> >         for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi);)
> > -        {
> > +	{
> 
> Nit: could this be done when moving the code in the previous patch instead?

Sure, can do that there.

	Jakub

  reply	other threads:[~2017-11-19 17:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-16 17:40 Jakub Jelinek
2017-11-17  9:53 ` Thomas Preudhomme
2017-11-19 18:54   ` Jakub Jelinek [this message]
2017-11-20 10:02 ` 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=20171119172608.GA14653@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kyrylo.tkachov@foss.arm.com \
    --cc=rguenther@suse.de \
    --cc=thomas.preudhomme@foss.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).