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: [sh PATCH] PR/27717, sh backend lies to reload about index registers


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


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