[sh PATCH] PR/27717, sh backend lies to reload about index registers

Paolo Bonzini bonzini@gnu.org
Mon Aug 21 17:43:00 GMT 2006


> That being said, I see no reason why your patch would prevent these 
> optimizations.

In fact your sanity check passes.

> void
> f(int i, int *a, int *b, int c)
> {
>  while (i--)
>    a[i] = b[i] / c;
> }
> 
> should only have two multiplies, a load, a store and some eight 
> shifts/additions/subtractions inside the loop.

If you have some time, a check for having just one ldx.ub and ldx.w 
could be easily put in the testsuite...

> This should use exactly nine muls instructions, and exactly one ldx.ub 
> and one ldx.w:
> 
> __complex__ int
> f (__complex__ int c, int d)
> {
>  return c/d;
> }

Likewise.

> When you compile this testcase with -mdiv=inv:fp -O2, no table loads 
> should be left:
> 
> int
> f (int a, int b)
> {
>  return a/b;
> }

Likewise.

Paolo



More information about the Gcc-patches mailing list