c/859: sparc-specific pessimal code for simple loop
Joe Buck
jbuck@racerx.synopsys.com
Tue Nov 21 13:41:00 GMT 2000
See the GNATS case c/859 for details. I was trying to understand the
strange results for the Stepanov abstraction penalty on the Sparc, and
the problem is that we generate very bad code for some simple
fortran-style loops on the Sparc, but the ix86 back end doesn't have
this problem. I originally saw the problem in C++, but it's in C as well.
The problem code is below. We get a rather wasteful 8-instruction inner
loop.
--------------------------
void check(double);
void test0(double* first, double* last)
{
int n, pdiff = last - first;
double result = 0;
for (n = 0; n < pdiff; ++n) result += first[n];
check(result);
}
More information about the Gcc-bugs
mailing list