From: Segher Boessenkool <segher@kernel.crashing.org>
To: vogt@linux.vnet.ibm.com, gcc-patches@gcc.gnu.org,
Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Subject: Re: [PATCH] combine: Omit redundant AND in change_zero_ext.
Date: Thu, 15 Dec 2016 09:19:00 -0000 [thread overview]
Message-ID: <20161215091620.GA30845@gate.crashing.org> (raw)
In-Reply-To: <20161215085552.GA17600@linux.vnet.ibm.com>
On Thu, Dec 15, 2016 at 09:55:52AM +0100, Dominik Vogt wrote:
> > > Bootstrapped and regression tested on s390x and s390. (Targets
> > > with risbg-like instructions (Power, others?) may need some
> > > tuning.)
> >
> > But, it is also possible I missed some. So please wait until I have
> > tested it.
> >
> > > diff --git a/gcc/combine.c b/gcc/combine.c
> > > index 19851a2..5ebf31c 100644
> > > --- a/gcc/combine.c
> > > +++ b/gcc/combine.c
> > > @@ -11280,8 +11280,13 @@ change_zero_ext (rtx pat)
> > > else
> > > continue;
> > >
> > > - wide_int mask = wi::mask (size, false, GET_MODE_PRECISION (mode));
> > > - x = gen_rtx_AND (mode, x, immed_wide_int_const (mask, mode));
> > > + if (!(GET_CODE (x) == LSHIFTRT
> > > + && CONST_INT_P (XEXP (x, 1))
> > > + && size + INTVAL (XEXP (x, 1)) == GET_MODE_PRECISION (mode)))
> > > + {
> > > + wide_int mask = wi::mask (size, false, GET_MODE_PRECISION (mode));
> > > + x = gen_rtx_AND (mode, x, immed_wide_int_const (mask, mode));
> > > + }
> >
> > One could argue that this should have been an lshiftrt in the first place
> > then, not a zero_ext*. Hrm.
>
> This one
>
> void g2(ui64 *pl, i32 seed)
> {
> seed = 69607 * seed;
> pl[0] = (seed >> 8) & 0xffffff;
> }
>
> generates
>
> (zero_extract:DI (reg:SI 75 [ seed ])
> (const_int 24 [0x18])
> (const_int 0 [0]))
>
> on s390x.
Ah, right, it changes mode as well. I see.
Tested on powerpc64-linux {-m32,-m64}, no new failures. The patch is
okay for trunk. Thanks!
Segher
next prev parent reply other threads:[~2016-12-15 9:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-14 10:15 Dominik Vogt
2016-12-14 19:55 ` Segher Boessenkool
2016-12-15 9:16 ` Dominik Vogt
2016-12-15 9:19 ` Segher Boessenkool [this message]
2016-12-19 9:57 ` Andreas Krebbel
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=20161215091620.GA30845@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=krebbel@linux.vnet.ibm.com \
--cc=vogt@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).