[PATCH 4/4] [Powerpc] tune/optimize memmove/wordcopy. Call memcpy when appropriate.

Andreas Schwab schwab@linux-m68k.org
Sat May 12 15:48:00 GMT 2012


Will Schmidt <will_schmidt@vnet.ibm.com> writes:

> diff --git a/sysdeps/powerpc/memmove.c b/sysdeps/powerpc/memmove.c
> index c74e556..80de8ac 100644
> --- a/sysdeps/powerpc/memmove.c
> +++ b/sysdeps/powerpc/memmove.c
> @@ -50,6 +50,10 @@ MEMMOVE (a1, a2, len)
>    unsigned long int dstp = (long int) dest;
>    unsigned long int srcp = (long int) src;
>  
> +  /* If there is no overlap between ranges, call the builtin memcpy.  */
> +  if ( (dstp >= (srcp + len)) || (srcp > (dstp + len)) )
> +    return __builtin_memcpy (dest, src, len);

In file included from bcopy.c:28:0:
../sysdeps/powerpc/memmove.c: In function ‘bcopy’:
../sysdeps/powerpc/memmove.c:54:5: warning: ‘return’ with a value, in function returning void [enabled by default]

Fixed as attached.

Andreas.

	* sysdeps/powerpc/memmove.c (MEMMOVE): Don't return a value if
	used as bcopy.

diff --git a/sysdeps/powerpc/memmove.c b/sysdeps/powerpc/memmove.c
index 8918283..1617ece 100644
--- a/sysdeps/powerpc/memmove.c
+++ b/sysdeps/powerpc/memmove.c
@@ -50,12 +50,12 @@ MEMMOVE (a1, a2, len)
   unsigned long int srcp = (long int) src;
 
   /* If there is no overlap between ranges, call the builtin memcpy.  */
-  if ( (dstp >= (srcp + len)) || (srcp > (dstp + len)) )
-    return __builtin_memcpy (dest, src, len);
+  if (dstp >= srcp + len || srcp > dstp + len)
+    __builtin_memcpy (dest, src, len);
 
   /* This test makes the forward copying code be used whenever possible.
      Reduces the working set.  */
-  if (dstp - srcp >= len)      /* *Unsigned* compare!  */
+  else if (dstp - srcp >= len)      /* *Unsigned* compare!  */
     {
       /* Copy from the beginning to the end.  */
 
-- 
1.7.10.2


-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



More information about the Libc-alpha mailing list