[PATCH 4/4] [Powerpc] tune/optimize memmove/wordcopy. Call memcpy when appropriate.
Segher Boessenkool
segher@kernel.crashing.org
Thu Mar 22 15:23:00 GMT 2012
> @@ -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.
> +
> /* 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.
Segher
More information about the Libc-alpha
mailing list