Re: [PATCH] lra: Canonicalize mult to shift in address reloads Hi Christophe,
On 28/08/2020 10:16, Christophe Lyon wrote: > Hi Alex, > > > On Wed, 26 Aug 2020 at 17:15, Alex Coplan <alex.cop...@arm.com> wrote: > > > > Thanks for the review, both. > > > > On 26/08/2020 09:19, Vladimir Makarov wrote: > > > > > > On 2020-08-26 5:06 a.m., Richard Sandiford wrote: > > > > Alex Coplan <alex.cop...@arm.com> writes: > > > > > > > > Minor nit, should be formatted as: > > > > > > > > static rtx > > > > canonicalize_reload_addr (rtx addr) > > > Sorry for missing this. Alex, it should be fixed anyway. > > > > > > > > I don't think we should we restrict this to (plus (mult X Y) Z), > > > > since addresses can be more complicated than that. One way to > > > > search for all MULTs is: > > > > > > > > subrtx_iterator::array_type array; > > > > FOR_EACH_SUBRTX (iter, array, x, NONCONST) > > > > { > > > > rtx x = *iter; > > > > if (GET_CODE (x) == MULT && CONST_INT_P (XEXP (x, 1))) > > > > ... > > > > } > > > > > > > > (Needs rtl-iter.h) > > > > > > I am agree it would be nice to process a general case. Alex, you can do > > > this as a separate patch if you want. > > > > > > Richard, thank you for looking at this patch too. > > > > > > > > > > Please find a reworked version of the patch attached incorporating > > Richard's feedback. > > > > Testing: > > * Bootstrap and regtest on aarch64-none-linux-gnu, > > arm-none-linux-gnueabihf, and x86_64-pc-linux-gnu: no regressions. > > > > Unfortunately, the new test fails on aarch64 with mabi=ilp32 > FAIL: gcc.target/aarch64/mem-shift-canonical.c scan-assembler-times > add_lsl_di 3 Thanks for catching this. It fails since we're looking for a pattern that could only be hit on LP64. Disabling the test on ILP32 since the problematic mult pattern was never hit there, so there's nothing to test. Committing as obvious. Thanks, Alex > > Christophe > --- gcc/testsuite/ChangeLog: * gcc.target/aarch64/mem-shift-canonical.c: Skip on ILP32. --- diff --git a/gcc/testsuite/gcc.target/aarch64/mem-shift-canonical.c b/gcc/testsuite/gcc.target/aarch64/mem-shift-canonical.c index 36beed497a0..47479ffff29 100644 --- a/gcc/testsuite/gcc.target/aarch64/mem-shift-canonical.c +++ b/gcc/testsuite/gcc.target/aarch64/mem-shift-canonical.c @@ -3,6 +3,7 @@ /* { dg-do compile } */ /* { dg-options "-Os -ftree-vectorize -dp" } */ +/* { dg-require-effective-target lp64 } */ struct T