Array prefetch patch

Jan Hubicka jh@suse.cz
Tue Dec 11 10:15:00 GMT 2001


> On Tue, Dec 11, 2001 at 09:54:59AM +0100, Jan Hubicka wrote:
> > > I've been playing with Honza's prefetch optimization patch, too, and
> > > have some changes to the one he just sent in:
> > > 
> [snip]
> > > 
> > >   Use of the function remove_constant_addition causes a failure in the
> > >   test gcc.c-torture/execute/920501-6.c when it is compiled with
> > >   "-O3 -fprefetch-loop-arrays".  With the call to it commented out it's
> > >   OK.  I can look into it further, since this is undoubtedly supposed
> > >   to be doing something useful.
> > Interesting, I went trought testsuite with -fprefetch-loop-arrays and it
> > did work for me.  What kind of failure you get?
> 
> This test case, based on code in 920501-6.c, uses the wrong address for
> str when compiled with "-O2 -fprefetch-loop-arrays" if I don't remove
> the call to remove_constant_addition:
> 
> int
> main ()
> {
>   int d;
>   unsigned int num;
>   char *str = "1234";
> 
>   num =  *str++ - '0';
>   d = *str++;
>   while (d != '\0')
>     {
>       num = num * 10 + d - '0';
>       d = *str++;
>     }
> 
>   if (num != 1234)
>     abort ();
> 
>   exit(0);
> }
The problem is in your perlimitary patch - it does define PREFETCH_SSE even
when TARGET_SSE is not defined making loop code to properly emit prefetch that
is not recognized with pattern having TARGET_SSE in the conditional.
After fixing that I can get it working, so I am sending updated patch in momentarity.

Honza



More information about the Gcc-patches mailing list