Re: Help with ivopts

2011-07-06 Thread Richard Sandiford
Michael Matz writes: > On Wed, 6 Jul 2011, Richard Sandiford wrote: >> But there's still the separate point that, when not considering >> addresses, this transformation doesn't seem to be a win, except >> in the constant case. > > My first example shows that on some targets it can be a win, also i

Re: Help with ivopts

2011-07-06 Thread Michael Matz
Hi, On Wed, 6 Jul 2011, Richard Sandiford wrote: > > It's only a strict win on targets where the addition in "(q-p) + n" > > can be hidden in either address generation, or combined with other > > arithmetic, or on all targets if (q-p) is a constant. > > Agreed on the constant thing. But is it

Re: Help with ivopts

2011-07-06 Thread Richard Sandiford
Michael Matz writes: > On Wed, 6 Jul 2011, Richard Sandiford wrote: >> But what I mean is: even with your starting loop, I'm comparing the >> transformation that this code does with the alternative, but rejected, >> transformation of simply treating both addresses as separate ivs. I.e.: >> >>

Re: Help with ivopts

2011-07-06 Thread Michael Matz
Hi, On Wed, 6 Jul 2011, Richard Sandiford wrote: > But what I mean is: even with your starting loop, I'm comparing the > transformation that this code does with the alternative, but rejected, > transformation of simply treating both addresses as separate ivs. I.e.: > > i=0; i < end; i+=1 >

Re: Help with ivopts

2011-07-06 Thread Richard Sandiford
Michael Matz writes: > On Wed, 6 Jul 2011, Richard Sandiford wrote: >> > If the target allows (q-p)[n] to be used directly as an address, and >> > if the target has no post-increment instruction, then it might be >> > better. But I think it's a loss on other targets. It might even be a >> > lo

Re: Help with ivopts

2011-07-06 Thread Michael Matz
Hi, On Wed, 6 Jul 2011, Richard Sandiford wrote: > > If the target allows (q-p)[n] to be used directly as an address, and > > if the target has no post-increment instruction, then it might be > > better. But I think it's a loss on other targets. It might even be a > > loss on targets (like Po

Re: Help with ivopts

2011-07-06 Thread Richard Sandiford
Richard Sandiford writes: > Michael Matz writes: >> On Wed, 6 Jul 2011, Richard Sandiford wrote: >>> If so, then: >>> >>> (a) That doesn't happen at the tree level. The subtraction is still inside >>> the loop at RTL generation time. >>> >>> (b) What's the advantage of introducing a new ho

Re: Help with ivopts

2011-07-06 Thread Richard Sandiford
Michael Matz writes: > On Wed, 6 Jul 2011, Richard Sandiford wrote: >> The individual difference_cost and add_cost seem reasonable (4 in each >> case). I don't understand the reasoning behind the division though. Is >> the idea that this should be hoisted? > > Yes, it should be hoisted outside

Re: Help with ivopts

2011-07-06 Thread Michael Matz
Hi, On Wed, 6 Jul 2011, Richard Sandiford wrote: > The individual difference_cost and add_cost seem reasonable (4 in each > case). I don't understand the reasoning behind the division though. Is > the idea that this should be hoisted? Yes, it should be hoisted outside the loop. The differenc