This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: strength reduction tweek


On Tuesday 07 August 2001 20:45, Jan Hubicka wrote:
> Hi,
> I am experimenting with following loop:
>
> float a[100][8];
> float b[100][8];
> main()
> {
>    int y,i;
>    for (y=0;y<100000;y++)
>    for (i=0;i<100;i++)
> 	{
> 	  a[i][0]=b[i][0]+1;
> 	  a[i][1]=b[i][1]+1;
> 	  a[i][2]=b[i][2]+1;
> 	  a[i][3]=b[i][3]+1;
> 	  a[i][4]=b[i][4]+1;
> 	  a[i][5]=b[i][5]+1;
> 	  a[i][6]=b[i][6]+1;
> 	  a[i][7]=b[i][7]+1;
> 	}
> }
>
> interestingly enought, gcc decides to not use i386 addressing modes and
> instead computes i*32+constant to register and then adds it in each
> instruction.
>
> The problem is that cost in strength_reduction is computed somewhat
> inexactly.  if we estimate cost of address reducing giv, we compute cost of
> replacing it by register.  I386 cost macro contains code to reduce
> register pressure and prefferes complex address, so the cost is negative.
>
> Later we manage to combine givs and we are about to replace the giv
> by even more complex addressing mode, but we don't recompute the benefit
> (that should be now possitive - it is zero, but I am sending separate
> patch for this shortly).
>
> Honza
>
> Tue Aug  7 20:24:09 CEST 2001  Jan Hubicka  <jh@suse.cz>
> 	* loop.c (combine_givs): Fix computing of benefit once giv is combined.

I tracked down that this patch fixes PR c/2100, but it seems to me that this 
patch doesn't fix the underlying problem in the loop code, but rather just 
avoids it for the testcase due to the changed cost calculation. Am I right?

Franz.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]