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; }