On Tue, Jul 29, 2008 at 7:26 AM, Agner Fog <[EMAIL PROTECTED]> wrote:
> Michael Matz wrote:
>>
>> You must be doing something wrong.  If the compiler decides to inline the
>> string ops it either knows the size or you told it to do it anyway
>> (-minline-all-stringops or -minline-stringops-dynamically).  In both cases
>> will it use wider than byte moves when possible.
>>
>
> g++ (v. 4.2.3) without any options converts memcpy with unknown size to  rep
> movsb

Make sure to use -D__NO_STRING_INLINES to not get glibcs inline
implementation.

Richard.

> g++ with option -fno-builtin calls memcpy in libc
>
> The rep movs, stos, scas, cmps instructions are slower than function calls
> except in rare cases. The compiler should never use the string instructions.
> It is OK to use mov instructions if the size is known, but not string
> instructions.
>

Reply via email to