Hi, On Tue, 29 Jul 2008, Agner Fog wrote:
> g++ (v. 4.2.3) without any options converts memcpy with unknown size to rep > movsb Use newer GCCs. They will (1) not expand memcpy inline for unknown sizes (without special options, also make sure you don't get the glibc inlines) and (2) won't expand to movsb. > The rep movs, stos, scas, cmps instructions are slower than function > calls except in rare cases. Depends on the microarchitecture. For AMD Fam10 for instance REP prefixes are the preferred form for sizes between page-size and half of L1 size, when destination is aligned. > The compiler should never use the string instructions. It is OK to use > mov instructions if the size is known, but not string instructions. General statements are generally wrong :) Ciao, Michael.