aboutsummaryrefslogtreecommitdiff
path: root/ports/sysdeps/tile/memcopy.h
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2012-11-02 12:53:57 -0400
committerChris Metcalf <cmetcalf@tilera.com>2012-11-06 09:24:19 -0500
commitcd84016efe83d92ee3903fef37f79ca2bafb3985 (patch)
tree7a92df4a9a081a6f20b8fd68f31139b6336e595c /ports/sysdeps/tile/memcopy.h
parent82477c28f46c579a149a8333c07233e9f4e43408 (diff)
downloadglibc-cd84016efe83d92ee3903fef37f79ca2bafb3985.zip
glibc-cd84016efe83d92ee3903fef37f79ca2bafb3985.tar.gz
glibc-cd84016efe83d92ee3903fef37f79ca2bafb3985.tar.bz2
Optimize tile (mostly tilegx) memcpy and memmove performance.
- Override <memcopy.h> so we use full 8-byte word copies on tilegx32 for memmove, then use op_t in memcpy instead of the previous locally-defined word_t just to avoid proliferating identical types. - Fix bug in memcpy prefetch that caused us to never prefetch past the first cache line. - Optimize misaligned memcpy by inlining _wordcopy_fwd_dest_aligned instead of just doing a dumb word-at-a-time copy. - Make memcpy safe for forward copies by doing all the loads from a given cache line prior to doing a wh64 (cache line zero-fill) on the destination. Remove now-redundant src == dst check. - Copy and optimize the generic wordcopy.c routines to use the tile "double align" instruction instead of the MERGE macro; to avoid offset addressing mode (which tile doesn't have) by rewriting the pointer math to load and store with a zero index; and to use post-increment addresses in the inner loops to improve scheduling.
Diffstat (limited to 'ports/sysdeps/tile/memcopy.h')
-rw-r--r--ports/sysdeps/tile/memcopy.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/ports/sysdeps/tile/memcopy.h b/ports/sysdeps/tile/memcopy.h
new file mode 100644
index 0000000..2bc3fce
--- /dev/null
+++ b/ports/sysdeps/tile/memcopy.h
@@ -0,0 +1,27 @@
+/* memcopy.h -- definitions for memory copy functions. Tile version.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdeps/generic/memcopy.h>
+#include <bits/wordsize.h>
+
+/* Support more efficient copying on tilegx32, which supports
+ long long as a native 64-bit type. */
+#if defined (__tilegx__) && __WORDSIZE == 32
+# undef op_t
+# define op_t unsigned long long int
+#endif