This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] combine: Improve change_zero_ext, call simplify_set afterwards.
On Fri, Dec 09, 2016 at 08:32:01PM +0100, Dominik Vogt wrote:
> > > This is a work in progress with the goal of fixing the first
> > > problem and similar ones by calling simplify_set after
> > > change_zero_ext to get rid of the overly complex code. That
> > > works fine in principle, but replaces back the (and (lshiftrt
> > > ...) ...) that change_zero_ext generates back into zero_extract
> > > form. Fiddling with simplify_set and make_compound_operation* a
> > > bit, trying to suppress undoing the transformations that
> > > change_zero_ext has just done, resulted in the (unfinished)
> > > patch.
> >
> > This we cannot do: we cannot call simplify* here. The problem is
> > combine can reuse the old target reg of an insn it combines but the
> > simplify* will still see the old nonzero_bits for that register.
> >
> > The best solution to that is to not reuse registers at all, but that
> > will have to wait until GCC 8.
> >
> > > As it's not clear to me whether this is a valid approach I'd
> > > appreciate any advice on the patch or alternative ways of doing
> > > that.
> >
> > Currently I just handle all cases manually in change_zero_ext, but
> > that is not nice at all for your case.
>
> You mean, inside change_zero_ext just look for for any "(and
> (subreg (zero_extract ...)))" where the zero_extract gets replaced
> later and the two and masks can be merged into one, and do that
> manually? I'll try that.
You can also code those patterns (in your MD) as the zero_extract
form, if that works nicer? This is for RNSBG, right, so you also
need to handles RXSBG and ROSBG, maybe you can do those in the
same pattern?
Segher