Ping.

Hopefully this is easier to review/test now that we fix the AArch64 bug first
and deliberately regress code quality so that the impact of the combine patch
can be measured.

On 15/10/2020 09:59, Alex Coplan via Gcc-patches wrote:
> Currently, make_extraction() identifies where we can emit an ASHIFT of
> an extend in place of an extraction, but fails to make the corresponding
> canonicalization/simplification when presented with a MULT by a power of
> two. Such a representation is canonical when representing a left-shifted
> address inside a MEM.
> 
> This patch remedies this situation: after the patch, make_extraction()
> now also identifies RTXs such as:
> 
> (mult:DI (subreg:DI (reg:SI r)) (const_int 2^n))
> 
> and rewrites this as:
> 
> (mult:DI (sign_extend:DI (reg:SI r)) (const_int 2^n))
> 
> instead of using a sign_extract.
> 
> (This patch also fixes up a comment in expand_compound_operation() which
> appears to have suffered from bitrot.)
> 
> This fixes several quality regressions on AArch64 after removing support for
> addresses represented as sign_extract insns (1/2).
> 
> In particular, after the fix for PR96998, for the relevant testcase, we
> have:
> 
> .L2:
>         sxtw    x0, w0  // 8    [c=4 l=4]  *extendsidi2_aarch64/0
>         add     x0, x19, x0, lsl 2      // 39   [c=8 l=4]  *add_lsl_di
>         bl      h               // 11   [c=4 l=4]  *call_value_insn/1
>         b       .L2             // 54   [c=4 l=4]  jump
> 
> and after this patch, we have:
> 
> .L2:
>         add     x0, x19, w0, sxtw 2     // 39   [c=8 l=4]  
> *add_extendsi_shft_di
>         bl      h               // 11   [c=4 l=4]  *call_value_insn/1
>         b       .L2             // 54   [c=4 l=4]  jump
> 
> which restores the original optimal sequence we saw before the AArch64
> patch.
> 
> Testing:
>  * Bootstrapped and regtested on aarch64-linux-gnu, arm-linux-gnueabihf,
>    and x86_64-linux-gnu.
> 
> OK for trunk?
> 
> Thanks,
> Alex
> 
> ---
> 
> gcc/ChangeLog:
> 
>       * combine.c (expand_compound_operation): Tweak variable name in
>       comment to match source.
>       (make_extraction): Handle mult by power of two in addition to
>       ashift.
> 
> ---
>  gcc/combine.c | 37 ++++++++++++++++++++++---------------
>  1 file changed, 22 insertions(+), 15 deletions(-)

Reply via email to