aboutsummaryrefslogtreecommitdiffstats
path: root/arch/tile/lib/memset_64.c
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2013-08-01 15:52:17 -0400
committerChris Metcalf <cmetcalf@tilera.com>2013-08-01 16:23:12 -0400
commitc53c70a90fdce3e7a53a0412abf7cc2b2a645988 (patch)
tree0b1ec6d04be95ac07563ba518047be73973d25d8 /arch/tile/lib/memset_64.c
parenttile: convert uses of "inv" to "finv" (diff)
downloadlinux-dev-c53c70a90fdce3e7a53a0412abf7cc2b2a645988.tar.xz
linux-dev-c53c70a90fdce3e7a53a0412abf7cc2b2a645988.zip
tile: optimize and clean up string functions
This change cleans up the string code in a number of ways: - For memcpy(), fix bug in prefetch and increase distance to 3 lines; optimize for unaligned data; do all loads before wh64 to make memcpy safe for forward-overlapping calls; etc. Performance is improved. - Use new copy_byte() function on tilegx to spread a single byte value out into a full word using the shufflebytes instruction. - Clean up header include ordering to be more canonical, and remove spurious #undefs of function names. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Diffstat (limited to 'arch/tile/lib/memset_64.c')
-rw-r--r--arch/tile/lib/memset_64.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/arch/tile/lib/memset_64.c b/arch/tile/lib/memset_64.c
index 3873085711d5..03ef69cd73de 100644
--- a/arch/tile/lib/memset_64.c
+++ b/arch/tile/lib/memset_64.c
@@ -12,13 +12,11 @@
* more details.
*/
-#include <arch/chip.h>
-
#include <linux/types.h>
#include <linux/string.h>
#include <linux/module.h>
-
-#undef memset
+#include <arch/chip.h>
+#include "string-endian.h"
void *memset(void *s, int c, size_t n)
{
@@ -70,8 +68,7 @@ void *memset(void *s, int c, size_t n)
n64 = n >> 3;
/* Tile input byte out to 64 bits. */
- /* KLUDGE */
- v64 = 0x0101010101010101ULL * (uint8_t)c;
+ v64 = copy_byte(c);
/* This must be at least 8 or the following loop doesn't work. */
#define CACHE_LINE_SIZE_IN_DOUBLEWORDS (CHIP_L2_LINE_SIZE() / 8)