On Wed, Nov 2, 2022 at 9:40 AM Dimitrije Milosevic <dimitrije.milose...@syrmia.com> wrote: > > Hi Jeff, > > > This is exactly what I was trying to get to. If the addressing mode > > isn't supported, then we shouldn't be picking it as a candidate. If it > > is, then we've probably got a problem somewhere else in this code and > > this patch is likely papering over it.
I'm not sure this is accurate but at least the cost of using an unsupported addressing mode should be at least that of the compensating code to mangle it to a supported form. > I'll take a deeper look into the candidate selection algorithm then. Will > get back to you. Thanks - as said the unfortunate situation is that both the original author and the one who did the last bigger reworks of the code are gone. Richard. > Regards, > Dimitrije > > ________________________________________ > From: Jeff Law <jeffreya...@gmail.com> > Sent: Tuesday, November 1, 2022 7:46 PM > To: Richard Biener; Dimitrije Milosevic > Cc: gcc-patches@gcc.gnu.org; Djordje Todorovic > Subject: Re: [PATCH 1/2] ivopts: Revert computation of address cost > complexity. > > > On 10/28/22 01:00, Richard Biener wrote: > > On Fri, Oct 28, 2022 at 8:43 AM Dimitrije Milosevic > > <dimitrije.milose...@syrmia.com> wrote: > >> Hi Jeff, > >> > >>> THe part I don't understand is, if you only have BASE+OFF, why does > >>> preventing the calculation of more complex addressing modes matter? ie, > >>> what's the point of computing the cost of something like base + off + > >>> scaled index when the target can't utilize it? > >> Well, the complexities of all addressing modes other than BASE + OFFSET are > >> equal to 0. For targets like Mips, which only has BASE + OFFSET, it would > >> still > >> be more complex to use a candidate with BASE + INDEX << SCALE + OFFSET > >> than a candidate with BASE + INDEX, for example, as it has to compensate > >> the lack of other addressing modes somehow. If complexities for both of > >> those are equal to 0, in cases where complexities decide which candidate is > >> to be chosen, a more complex candidate may be picked. > > But something is wrong then - it shouldn't ever pick a candidate with > > an addressing > > mode that isn't supported? So you say that the cost of expressing > > 'BASE + INDEX << SCALE + OFFSET' as 'BASE + OFFSET' is not computed > > accurately? > > This is exactly what I was trying to get to. If the addressing mode > isn't supported, then we shouldn't be picking it as a candidate. If it > is, then we've probably got a problem somewhere else in this code and > this patch is likely papering over it. > > > Jeff >