aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/lib
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2009-03-26 10:24:37 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2009-03-26 10:24:24 -0400
commit1edad85b16fdda43c8ab809e2779e8bf64ab8bb2 (patch)
tree45e777718c8fda461c2232f2b74b8dc0a04e4ea6 /arch/s390/lib
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')
-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 ae5cf5d03d41..4143b7c19096 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)
44 */ 44 */
45size_t strlen(const char *s) 45size_t strlen(const char *s)
46{ 46{
47#if __GNUC__ < 4
47 return __strend(s) - s; 48 return __strend(s) - s;
49#else
50 return __builtin_strlen(s);
51#endif
48} 52}
49EXPORT_SYMBOL(strlen); 53EXPORT_SYMBOL(strlen);
50 54
@@ -70,6 +74,7 @@ EXPORT_SYMBOL(strnlen);
70 */ 74 */
71char *strcpy(char *dest, const char *src) 75char *strcpy(char *dest, const char *src)
72{ 76{
77#if __GNUC__ < 4
73 register int r0 asm("0") = 0; 78 register int r0 asm("0") = 0;
74 char *ret = dest; 79 char *ret = dest;
75 80
@@ -78,6 +83,9 @@ char *strcpy(char *dest, const char *src)
78 : "+&a" (dest), "+&a" (src) : "d" (r0) 83 : "+&a" (dest), "+&a" (src) : "d" (r0)
79 : "cc", "memory" ); 84 : "cc", "memory" );
80 return ret; 85 return ret;
86#else
87 return __builtin_strcpy(dest, src);
88#endif
81} 89}
82EXPORT_SYMBOL(strcpy); 90EXPORT_SYMBOL(strcpy);
83 91