diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2009-03-26 15:24:37 +0100 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2009-03-26 15:24:24 +0100 |
commit | 1edad85b16fdda43c8ab809e2779e8bf64ab8bb2 (patch) | |
tree | 45e777718c8fda461c2232f2b74b8dc0a04e4ea6 /arch/s390/include | |
parent | 504665a91498f43d220b7d0942281067283a35f7 (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/include')
-rw-r--r-- | arch/s390/include/asm/string.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/s390/include/asm/string.h b/arch/s390/include/asm/string.h index adf079170aa..cd0241db5a4 100644 --- a/arch/s390/include/asm/string.h +++ b/arch/s390/include/asm/string.h @@ -100,6 +100,7 @@ static inline char *strcat(char *dst, const char *src) static inline char *strcpy(char *dst, const char *src) { +#if __GNUC__ < 4 register int r0 asm("0") = 0; char *ret = dst; @@ -109,10 +110,14 @@ static inline char *strcpy(char *dst, const char *src) : "+&a" (dst), "+&a" (src) : "d" (r0) : "cc", "memory"); return ret; +#else + return __builtin_strcpy(dst, src); +#endif } static inline size_t strlen(const char *s) { +#if __GNUC__ < 4 register unsigned long r0 asm("0") = 0; const char *tmp = s; @@ -121,6 +126,9 @@ static inline size_t strlen(const char *s) " jo 0b" : "+d" (r0), "+a" (tmp) : : "cc"); return r0 - (unsigned long) s; +#else + return __builtin_strlen(s); +#endif } static inline size_t strnlen(const char * s, size_t n) |