Hi Jocke: Am 29.05.09 08:31 schrieb(en) Joakim Tjernlund:
> No (and I wasn't aware of the PPC pre-inc vs. post-inc stuff) - I justI think this is true for most RISC based CPU's. It is a pity as post ops are a lot more common. The do {} while(--chunks) is alsobetter. Basically the "while(--chunks)" is free(but only if you don't usechunks inside the loop).
Just a side note: I looked at the assembly output of gcc 4.3.3 coming with Ubuntu Jaunty/PowerPC for
<snip case="1">
n >>= 2;
do {
*++dst = *++src;
} while (--n);
<snip>
and
<snip case="2">
n >>= 2;
while (n--)
*dst++ = *src++;
</snip>
Using the gcc options "-O2 -mcpu=603e -mtune=603e" (same effect with
"-O3" instead of "-O2") the loop core is *exactly* the same in both
cases.
With gcc 4.2.2 (coming with ELDK 4.2) the loop core in case 2 is indeed one statement longer, though...
Best, Albrecht.
pgpPEJlVUM1dF.pgp
Description: PGP signature
_______________________________________________ Linuxppc-dev mailing list [email protected] https://ozlabs.org/mailman/listinfo/linuxppc-dev
