summaryrefslogtreecommitdiff
path: root/libc/string
diff options
context:
space:
mode:
Diffstat (limited to 'libc/string')
-rw-r--r--libc/string/sparc/_glibc_inc.h2
-rw-r--r--libc/string/x86_64/_glibc_inc.h7
-rw-r--r--libc/string/x86_64/memset.S8
-rw-r--r--libc/string/x86_64/strcat.S1
-rw-r--r--libc/string/x86_64/strchr.S1
-rw-r--r--libc/string/x86_64/strcpy.S2
-rw-r--r--libc/string/x86_64/strcspn.S3
-rw-r--r--libc/string/x86_64/strlen.S1
8 files changed, 14 insertions, 11 deletions
diff --git a/libc/string/sparc/_glibc_inc.h b/libc/string/sparc/_glibc_inc.h
index 4eb4d755c..e0aef52c2 100644
--- a/libc/string/sparc/_glibc_inc.h
+++ b/libc/string/sparc/_glibc_inc.h
@@ -6,6 +6,8 @@
#include <features.h>
#include <bits/wordsize.h>
+/* Is alignment really needed? */
+
#if __WORDSIZE == 32
# define ENTRY_ALIGN 4
#else
diff --git a/libc/string/x86_64/_glibc_inc.h b/libc/string/x86_64/_glibc_inc.h
index 88cef2ea3..415ce90a7 100644
--- a/libc/string/x86_64/_glibc_inc.h
+++ b/libc/string/x86_64/_glibc_inc.h
@@ -6,15 +6,8 @@
#include <features.h>
#include <bits/wordsize.h>
-#if __WORDSIZE == 32
-# define ENTRY_ALIGN 4
-#else
-# define ENTRY_ALIGN 2
-#endif
-
#define ENTRY(sym) \
.global sym; \
- .align ENTRY_ALIGN; \
.type sym,%function; \
sym:
diff --git a/libc/string/x86_64/memset.S b/libc/string/x86_64/memset.S
index d72d74468..0f054ade6 100644
--- a/libc/string/x86_64/memset.S
+++ b/libc/string/x86_64/memset.S
@@ -71,7 +71,7 @@ ENTRY (memset)
jae 11f
.p2align 4
-3: /* Copy 64 bytes. */
+3: /* Fill 64 bytes. */
mov %r8,(%rcx)
mov %r8,0x8(%rcx)
mov %r8,0x10(%rcx)
@@ -84,7 +84,7 @@ ENTRY (memset)
dec %rax
jne 3b
-4: /* Copy final bytes. */
+4: /* Fill final bytes. */
and $0x3f,%edx
mov %rdx,%rax
shr $0x3,%rax
@@ -107,7 +107,7 @@ ENTRY (memset)
jne 8b
9:
#if BZERO_P
- nop
+ nop /* huh?? */
#else
/* Load result (only if used as memset). */
mov %rdi,%rax /* start address of destination is result */
@@ -115,7 +115,7 @@ ENTRY (memset)
retq
.p2align 4
-11: /* Copy 64 bytes without polluting the cache. */
+11: /* Fill 64 bytes without polluting the cache. */
/* We could use movntdq %xmm0,(%rcx) here to further
speed up for large cases but let's not use XMM registers. */
movnti %r8,(%rcx)
diff --git a/libc/string/x86_64/strcat.S b/libc/string/x86_64/strcat.S
index 9b0068981..ddec8ee79 100644
--- a/libc/string/x86_64/strcat.S
+++ b/libc/string/x86_64/strcat.S
@@ -21,6 +21,7 @@
#include "_glibc_inc.h"
+/* Seems to be unrolled too much */
.text
ENTRY (BP_SYM (strcat))
diff --git a/libc/string/x86_64/strchr.S b/libc/string/x86_64/strchr.S
index 8e59c4c19..c357bfd03 100644
--- a/libc/string/x86_64/strchr.S
+++ b/libc/string/x86_64/strchr.S
@@ -20,6 +20,7 @@
#include "_glibc_inc.h"
+/* Seems to be unrolled too much */
.text
ENTRY (BP_SYM (strchr))
diff --git a/libc/string/x86_64/strcpy.S b/libc/string/x86_64/strcpy.S
index d9a51b0bb..920d0543a 100644
--- a/libc/string/x86_64/strcpy.S
+++ b/libc/string/x86_64/strcpy.S
@@ -20,6 +20,8 @@
#include "_glibc_inc.h"
+/* Seems to be unrolled too much */
+
#ifndef USE_AS_STPCPY
# define STRCPY strcpy
#endif
diff --git a/libc/string/x86_64/strcspn.S b/libc/string/x86_64/strcspn.S
index fed12b5f6..c02fbbb5f 100644
--- a/libc/string/x86_64/strcspn.S
+++ b/libc/string/x86_64/strcspn.S
@@ -25,6 +25,9 @@
#include "_glibc_inc.h"
+/* Seems to be unrolled too much */
+/* (and why testb $0xff, %cl, not testb %cl, %cl?) */
+
/* BEWARE: `#ifdef strcspn' means that strcspn is redefined as `strpbrk' */
#define STRPBRK_P (defined strcspn)
diff --git a/libc/string/x86_64/strlen.S b/libc/string/x86_64/strlen.S
index 0441dc46c..e79537f87 100644
--- a/libc/string/x86_64/strlen.S
+++ b/libc/string/x86_64/strlen.S
@@ -20,6 +20,7 @@
#include "_glibc_inc.h"
+/* Seems to be unrolled too much */
.text
ENTRY (strlen)