[PATCH] sh4: use optimized asm version of memcpy - add config option to support backward copying

Carmelo AMOROSO carmelo.amoroso at st.com
Tue Mar 27 05:14:03 PDT 2007


Mike Frysinger wrote:
> On Wednesday 21 March 2007, Carmelo AMOROSO wrote:
>   
>> I'm currently using on uClibc-nptl for sh4 an optimized version
>> of the memcpy function (from Stuart Menefy @STMicroelectronics).
>> This implementation is based on 'backward copying'
>> and brakes the current implementation of 'memmove'
>> (libc/string/generic/memmove.c)
>> that, as clearly stated, assumes memcpy does a forward copying.
>>
>> The attached patch provides a solution for this adding a config option
>> to specify what kind of memcpy implementation the architecture provides.
>> In this way the memmove works with both implementation.
>>     
>
> if anything, this option should not be exported for the user to try and figure 
> out ... either the architecture provides it or it doesnt which means it'd be 
> a hardcoded selection in the arch-specific config.in files ...
>
>   
ok, agree; I'll remove the config entry from Configs/Config.in and put 
it into Configs/Config.sh only.
but it still needs to keep the #ifdef ARCH_HAS_BWD_MEMCPY into the 
generic memmove.c
> wouldnt it be simpler to provide a superh optimized memmove/memcpy ?  then it 
> wouldnt matter what the generic implementations assume ...
>   
the string/generic/memmove.c implementation is the same as the glibc 
except for the extra #if 1 added into uClibc.
This memmove.c code is what we are using with the glibc too, so it 
doesn't exist a special memmove implementation for sh4.
I'll post the reviewed patch again.

Regards,
Carmelo
> -mike
>   



More information about the uClibc mailing list