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: Segher Boessenkool <segher at kernel dot crashing dot org>
- Cc: libc-alpha at sourceware dot org, willschm at us dot ibm dot com
- Date: Tue, 03 Apr 2012 13:08:45 -0500
- Subject: Re: [PATCH 4/4] [Powerpc] tune/optimize memmove/wordcopy. Callmemcpy when appropriate.
- References: <20120319210108.24160.63510.stgit@brimstone> <20120319210210.24160.21914.stgit@brimstone> <3584A937-C8D4-492A-AA4D-BDF963C2A287@kernel.crashing.org>
- Reply-to: will_schmidt at vnet dot ibm dot com
On Thu, 2012-03-22 at 16:22 +0100, Segher Boessenkool wrote:
> > @@ -51,6 +51,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);
>
> You can use >= instead of > here.
Updated, Thanks,
> > +
> > /* This test makes the forward copying code be used whenever
> > possible.
> > Reduces the working set. */
> > if (dstp - srcp >= len) /* *Unsigned* compare! */
>
> This test is then simply "dstp < srcp", might be more readable.
Agreed, but unfortunately that doesn't work. I tried this, plus a few
variations, and in the end the unsigned delta and compare against length
suggests that the _bwd functions only get called if there is overlap,
rather than for all actual 'backwards' copies as suggested by the
function names. Changing the if statement causes glibc to throw "double
free or corruption" errors during make check, so thats a no-go.
Thanks,
-Will
>
>
> Segher
>