[Bug tree-optimization/55162] Loop ivopts cuts off top bits of loop counter
olegendo at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Nov 1 10:12:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55162
--- Comment #1 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-11-01 10:11:46 UTC ---
(In reply to comment #0)
> The same could be done on SH, too (comparing against the end address instead of
> using a loop counter), but it would add a loop setup overhead. In the optimal
> case the above function would result in the following SH code:
>
> tst r5,r5
> bt/s .L6
> mov #0,r0
> .L3:
> mov.l @r4+,r1
> dt r5
> bf/s .L3
> add r1,r0
> .L6:
> rts
> nop
>
... which is the case if '*x++' is used instead of 'x[i]':
int test (int* x, unsigned int c)
{
int s = 0;
unsigned int i;
for (i = 0; i < c; ++i)
s += *x++;
return s;
}
More information about the Gcc-bugs
mailing list