This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 4/4] [Powerpc] tune/optimize memmove/wordcopy. Callmemcpy when appropriate.
- From: Will Schmidt <will_schmidt at vnet dot ibm dot com>
- To: Andreas Schwab <schwab at linux-m68k dot org>
- Cc: libc-alpha at sourceware dot org, willschm at us dot ibm dot com
- Date: Mon, 14 May 2012 09:00:58 -0500
- Subject: Re: [PATCH 4/4] [Powerpc] tune/optimize memmove/wordcopy. Callmemcpy when appropriate.
- References: <20120403180700.5689.57731.stgit@brimstone> <20120403180820.5689.14118.stgit@brimstone> <m27gwhh03j.fsf@igel.home>
- Reply-to: will_schmidt at vnet dot ibm dot com
On Sat, 2012-05-12 at 17:48 +0200, Andreas Schwab wrote:
> 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.
Thanks, I obviously missed my check-for-warnings step on this one. :-o
Your change is good. I didn't notice earlier, but looks like there is
a RETURN(s) and rettype #define mechanism that is meant to handle the
different function return types, that could also have worked here too.
Thanks,
-Will
>
> 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
>
>