[PATCH 2/6] combine: If recog fails, try again with zero_ext{ract,end} simplified
Jeff Law
law@redhat.com
Mon May 11 04:15:00 GMT 2015
On 05/10/2015 10:13 AM, Segher Boessenkool wrote:
> Combine has its own ideas of what is "canonical" RTL, forcing all
> backends to have special patterns in their machine description for the
> "more simplified" patterns combine often creates, even though the
> backend already has patterns for a more general form. Backends that
> do not implement those patterns get less well optimised code.
>
> This patch lifts that burden for two cases: combine often converts
> an AND (with, say, 0xff) to a ZERO_EXTEND of a SUBREG; and an LSHIFTRT
> followed by an AND to a ZERO_EXTRACT. This is perfectly helpful for
> e.g. MEMs, but not nice if you have instructions to do more generic
> masking (like PowerPC rlwinm, and similar on some other archs).
>
> With this patch, if recog_for_combine fails, and there are any
> ZERO_EXT* in the pattern to be matched, it tries again with those
> expressed as AND etc. If that also fails it rolls back the changes,
> because it might still match after e.g. splitting, and we want to
> try the ZERO_EXT* for that as well.
>
> Tested on powerpc-linux, before and after removing many patterns
> from the machine description, and checked that the only changes in
> the bootstrapped compiler are new and removed functions.
>
> I'll also test on x86_64-linux before committing.
>
>
> Segher
>
>
> 2015-05-10 Segher Boessenkool <segher@kernel.crashing.org>
>
> * combine.c (recog_for_combine_1): New function, factored out
> from recog_for_combine.
> (change_zero_ext): New function.
> (recog_for_combine): If recog fails, try again with the pattern
> modified by change_zero_ext; if that still fails, restore the
> pattern.
I like it. Attacking the extensions are the most obvious candidates,
but I wonder if there's others (like the whole "ASHIFT vs MULT" stuff
that we were recently looking at for ARM).
jeff
More information about the Gcc-patches
mailing list