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

Carmelo AMOROSO carmelo.amoroso at st.com
Mon May 7 12:12:54 UTC 2007


Paul Mundt wrote:
> On Sun, Mar 25, 2007 at 09:18:33AM -0400, 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 ...
>>
>> wouldnt it be simpler to provide a superh optimized memmove/memcpy ?  then it 
>> wouldnt matter what the generic implementations assume ...
>>     
>
> It has to be split out separately for sh4, given the movca.l usage.
>   
Hi All,
I've updated the previous patch to keep into account both suggestions 
made by Mike and Paul.
A brief explanation of the changes follows:

extra/Configs/Config.in         -> set the TARGET_SUBARCH for the sh4 
architecture
extra/Configs/Config.in.sh      ->  set on the ARCH_HAS_BWD_MEMCPY for 
sh4 architecture only

libc/string/sh/sh4                  -> new file memcpy.S (sh4 specific)
libc/string/generic/memmove.c   -> use the new macro 
__ARCH_HAS_BWD_MEMCPY__ instead of #if 1
libc/string/generic/memcpy.c    ->  move static function from C source 
to common header file with some reorder
libc/string/generic/memcopy.h   ->  ""
libc/string/Makefile.in               -> add code the manage subarch 
specific code in addition to the arch specific one.

Any comments are welcome.

Cheers,
Carmelo
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: backward_memcpy_sh4.patch
Url: http://lists.busybox.net/pipermail/uclibc/attachments/20070507/9f42599a/attachment-0002.diff 


More information about the uClibc mailing list