Re: [PATCH] lra: Canonicalize mult to shift in address reloads

2021-04-08 Thread Maciej W. Rozycki
On Thu, 8 Apr 2021, Maciej W. Rozycki wrote: > > Does the patch also help to optimise my example above? If so, > > it sounds like a good thing for that reason alone. > > Nope, it actually regresses code produced, causing an extra instruction > to be used where it doesn't have to: > > --- test

Re: [PATCH] lra: Canonicalize mult to shift in address reloads

2021-04-08 Thread Maciej W. Rozycki
On Thu, 25 Mar 2021, Richard Sandiford wrote: > "Maciej W. Rozycki" writes: > > On Wed, 26 Aug 2020, Vladimir Makarov via Gcc-patches wrote: > > > >> On 2020-08-26 5:06 a.m., Richard Sandiford wrote: > >> > > >> > I don't think we should we restrict this to (plus (mult X Y) Z), > >> > since addr

Re: [PATCH] lra: Canonicalize mult to shift in address reloads

2021-03-25 Thread Richard Sandiford via Gcc-patches
"Maciej W. Rozycki" writes: > On Wed, 26 Aug 2020, Vladimir Makarov via Gcc-patches wrote: > >> On 2020-08-26 5:06 a.m., Richard Sandiford wrote: >> > >> > 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 >> > sea

Re: [PATCH] lra: Canonicalize mult to shift in address reloads

2021-03-24 Thread Maciej W. Rozycki
On Wed, 26 Aug 2020, Vladimir Makarov via Gcc-patches wrote: > On 2020-08-26 5:06 a.m., Richard Sandiford wrote: > > > > 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: > > > >sub

Re: [PATCH] lra: Canonicalize mult to shift in address reloads

2020-08-28 Thread Alex Coplan
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 wrote: > > > > Thanks for the review, both. > > > > On 26/08/2020 09:19, Vl

Re: [PATCH] lra: Canonicalize mult to shift in address reloads

2020-08-28 Thread Christophe Lyon via Gcc-patches
Hi Alex, On Wed, 26 Aug 2020 at 17:15, Alex Coplan 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 writes: > > > > > > Minor nit, should be formatted as: > > > > > > static rtx >

Re: [PATCH] lra: Canonicalize mult to shift in address reloads

2020-08-26 Thread Vladimir Makarov via Gcc-patches
On 2020-08-26 11:15 a.m., Alex Coplan wrote: Thanks for the review, both. 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.

Re: [PATCH] lra: Canonicalize mult to shift in address reloads

2020-08-26 Thread Alex Coplan
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 writes: > > > > Minor nit, should be formatted as: > > > > static rtx > > canonicalize_reload_addr (rtx addr) > Sorry for missing this.  Alex, it shou

Re: [PATCH] lra: Canonicalize mult to shift in address reloads

2020-08-26 Thread Vladimir Makarov via Gcc-patches
On 2020-08-26 5:06 a.m., Richard Sandiford wrote: Alex Coplan 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 addresse

Re: [PATCH] lra: Canonicalize mult to shift in address reloads

2020-08-26 Thread Richard Sandiford
Alex Coplan writes: > Hello, > > Inside a (mem) RTX, it is canonical to write multiplications by powers > of two using a (mult) [0]. For example, given the following C function: > > long f(long *p, long x) > { > return p[x]; > } > > AArch64 GCC generates the following RTL insn (in final): > >

Re: [PATCH] lra: Canonicalize mult to shift in address reloads

2020-08-25 Thread Vladimir Makarov via Gcc-patches
On 2020-08-25 6:18 a.m., Alex Coplan wrote: The motivation here is to be able to remove several redundant patterns in the AArch64 backend. See the previous thread [1] for context. Testing: * Bootstrapped and regtested on aarch64-none-linux-gnu, x86_64-pc-linux-gnu. * New unit test whic

[PATCH] lra: Canonicalize mult to shift in address reloads

2020-08-25 Thread Alex Coplan
Hello, Inside a (mem) RTX, it is canonical to write multiplications by powers of two using a (mult) [0]. For example, given the following C function: long f(long *p, long x) { return p[x]; } AArch64 GCC generates the following RTL insn (in final): (set (reg/i:DI 0 x0) (mem:DI (plus:DI