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 4/4] [Powerpc] tune/optimize memmove/wordcopy. Call memcpy when appropriate.


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."


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