summaryrefslogtreecommitdiffstats
path: root/arch/s390/lib/string.c
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2009-03-26 15:24:37 +0100
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2009-03-26 15:24:24 +0100
commit1edad85b16fdda43c8ab809e2779e8bf64ab8bb2 (patch)
tree45e777718c8fda461c2232f2b74b8dc0a04e4ea6 /arch/s390/lib/string.c
parent504665a91498f43d220b7d0942281067283a35f7 (diff)
[S390] use compiler builtin versions of strlen/strcpy/strcat
Use builtin variants if gcc 4 or newer is used to compile the kernel. Generates better code than the asm variants. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/lib/string.c')
-rw-r--r--arch/s390/lib/string.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/s390/lib/string.c b/arch/s390/lib/string.c
index ae5cf5d03d4..4143b7c1909 100644
--- a/arch/s390/lib/string.c
+++ b/arch/s390/lib/string.c
@@ -44,7 +44,11 @@ static inline char *__strnend(const char *s, size_t n)
*/
size_t strlen(const char *s)
{
+#if __GNUC__ < 4
return __strend(s) - s;
+#else
+ return __builtin_strlen(s);
+#endif
}
EXPORT_SYMBOL(strlen);
@@ -70,6 +74,7 @@ EXPORT_SYMBOL(strnlen);
*/
char *strcpy(char *dest, const char *src)
{
+#if __GNUC__ < 4
register int r0 asm("0") = 0;
char *ret = dest;
@@ -78,6 +83,9 @@ char *strcpy(char *dest, const char *src)
: "+&a" (dest), "+&a" (src) : "d" (r0)
: "cc", "memory" );
return ret;
+#else
+ return __builtin_strcpy(dest, src);
+#endif
}
EXPORT_SYMBOL(strcpy);