This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Use memcpy in memmove when possible


On 1/09/2012, at 8:46 PM, Siddhesh Poyarekar wrote:

> On 1 September 2012 13:46, Maxim Kuvyrkov <maxim@codesourcery.com> wrote:
>> Several architectures, e.g., MIPS, have well-optimized memcpy implementations, which can also be used for either forward or backward direction in memmove.  This patch adds an option for ports to define MEMCPY_OK_FOR_{FWD,BWD}_MEMMOVE macros to make generic memmove use memcpy when safe to do so.
>> 
>> This patch speeds up forward-direction memmove on MIPS by 50%.  Tested with no regressions.
> 
> I'd like to see some test cases to go with this with overlapping as
> well as non-overlapping areas.

Testcases of what?

> Also, have you seen what happens when
> src > dest and the areas are overlapping? I have only skimmed through
> this, but I think something funny could happen in that case.

MIPS memcpy is safe to use for forward memmove even if the areas are overlapping.  Other architectures should be audited by their maintainers or other interested parties to figure out if their specific implementation of memcpy can be used for memmove.

--
Maxim Kuvyrkov
CodeSourcery / Mentor Graphics



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]