[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Delete x86 string functions
From: |
Flavio Cruz |
Subject: |
[PATCH] Delete x86 string functions |
Date: |
Tue, 17 Jan 2023 00:11:16 -0500 |
The i386 functions are not used and the more portable versions in kern/strings.c
are faster (1-4x faster in synthetic benchmarks compiled with -O2 on my x86_64
box).
---
i386/i386/strings.c | 54 ---------------------------------------------
1 file changed, 54 deletions(-)
diff --git a/i386/i386/strings.c b/i386/i386/strings.c
index 84a3bc16..f1752de2 100644
--- a/i386/i386/strings.c
+++ b/i386/i386/strings.c
@@ -94,57 +94,3 @@ memcmp(const void *s1, const void *s2, size_t n)
return (int)c1 - (int)c2;
}
#endif /* ARCH_STRING_MEMCMP */
-
-#ifdef ARCH_STRING_STRLEN
-size_t
-strlen(const char *s)
-{
- size_t n;
-
- n = (size_t)-1;
- asm volatile("repne scasb"
- : "+D" (s), "+c" (n)
- : "a" (0)
- : "memory");
- return ~n - 1;
-}
-#endif /* ARCH_STRING_STRLEN */
-
-#ifdef ARCH_STRING_STRCPY
-char *
-strcpy(char *dest, const char *src)
-{
- char *orig_dest;
-
- orig_dest = dest;
- asm volatile("1:\n"
- "lodsb\n"
- "stosb\n"
- "testb %%al, %%al\n"
- "jnz 1b\n"
- : "+D" (dest), "+S" (src)
- : : "al", "memory");
- return orig_dest;
-}
-#endif /* ARCH_STRING_STRCPY */
-
-#ifdef ARCH_STRING_STRCMP
-int
-strcmp(const char *s1, const char *s2)
-{
- unsigned char c1, c2;
-
- asm volatile("1:\n"
- "lodsb\n"
- "scasb\n"
- "jne 1f\n"
- "testb %%al, %%al\n"
- "jnz 1b\n"
- "1:\n"
- : "+D" (s1), "+S" (s2)
- : : "al", "memory");
- c1 = *(((const unsigned char *)s1) - 1);
- c2 = *(((const unsigned char *)s2) - 1);
- return (int)c1 - (int)c2;
-}
-#endif /* ARCH_STRING_STRCMP */
--
2.39.0
- [PATCH] Delete x86 string functions,
Flavio Cruz <=