This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 2/5] [Powerpc] tune/optimize memmove/wordcopy. Call memcpywhen appropriate.
- From: Will Schmidt <will_schmidt at vnet dot ibm dot com>
- To: libc-alpha at sourceware dot org
- Cc: willschm at us dot ibm dot com
- Date: Mon, 12 Mar 2012 16:38:16 -0500
- Subject: [PATCH 2/5] [Powerpc] tune/optimize memmove/wordcopy. Call memcpywhen appropriate.
- References: <20120312213742.28917.97709.stgit@brimstone>
[Powerpc] tune/optimize memmove/wordcopy. Call memcpy when appropriate.
Call the optimized __builtin_memcpy function if our memmove memory ranges do
not overlap. This allows us to take advantage of the powerpc optimized memcpy
code, and gives a healthy throughput boost.
2012-03-12 Will Schmidt <will_schmidt@vnet.ibm.com>
* sysdeps/powerpc/memmove.c: Call __builtin_memcopy() when source and
destination ranges are known not to overlap.
---
sysdeps/powerpc/memmove.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/sysdeps/powerpc/memmove.c b/sysdeps/powerpc/memmove.c
index 0799a08..6cd7e3f 100644
--- a/sysdeps/powerpc/memmove.c
+++ b/sysdeps/powerpc/memmove.c
@@ -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);
+
/* This test makes the forward copying code be used whenever possible.
Reduces the working set. */
if (dstp - srcp >= len) /* *Unsigned* compare! */