[RFC PATCH 09/20] x86: inline memcpy
From: Mathieu Desnoyers
Date: Tue Aug 17 2010 - 19:26:50 EST
Export an inline_memcpy() API. Useful when the memcpy size is unknown but the
caller cannot afford the cost of a function call. Useful for very frequent
memcpy callers.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
---
arch/x86/include/asm/string_32.h | 7 +++++++
arch/x86/include/asm/string_64.h | 7 +++++++
2 files changed, 14 insertions(+)
Index: linux.trees.git/arch/x86/include/asm/string_32.h
===================================================================
--- linux.trees.git.orig/arch/x86/include/asm/string_32.h 2010-06-21 17:50:21.000000000 -0400
+++ linux.trees.git/arch/x86/include/asm/string_32.h 2010-06-21 17:56:49.000000000 -0400
@@ -44,6 +44,13 @@ static __always_inline void *__memcpy(vo
return to;
}
+#define __HAVE_ARCH_INLINE_MEMCPY
+static __always_inline void *inline_memcpy(void *to, const void *from,
+ size_t n)
+{
+ return __memcpy(to, from, n);
+}
+
/*
* This looks ugly, but the compiler can optimize it totally,
* as the count is constant.
Index: linux.trees.git/arch/x86/include/asm/string_64.h
===================================================================
--- linux.trees.git.orig/arch/x86/include/asm/string_64.h 2010-06-21 17:50:21.000000000 -0400
+++ linux.trees.git/arch/x86/include/asm/string_64.h 2010-06-21 17:57:13.000000000 -0400
@@ -23,6 +23,13 @@ static __always_inline void *__inline_me
return to;
}
+#define __HAVE_ARCH_INLINE_MEMCPY
+static __always_inline void *inline_memcpy(void *to, const void *from,
+ size_t n)
+{
+ return __inline_memcpy(to, from, n);
+}
+
/* Even with __builtin_ the compiler may decide to use the out of line
function. */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/