svn commit: trunk/uClibc/libc/string/x86_64
vda at uclibc.org
vda at uclibc.org
Tue Apr 15 08:23:20 UTC 2008
Author: vda
Date: 2008-04-15 01:23:19 -0700 (Tue, 15 Apr 2008)
New Revision: 21736
Log:
amd64 string ops: replace some instructions by smaller ones,
e.g. testb $0xff, %cl -> testb %cl, %cl
Modified:
trunk/uClibc/libc/string/x86_64/memset.S
trunk/uClibc/libc/string/x86_64/strcat.S
trunk/uClibc/libc/string/x86_64/strcspn.S
trunk/uClibc/libc/string/x86_64/strlen.S
trunk/uClibc/libc/string/x86_64/strspn.S
Changeset:
Modified: trunk/uClibc/libc/string/x86_64/memset.S
===================================================================
--- trunk/uClibc/libc/string/x86_64/memset.S 2008-04-15 01:17:50 UTC (rev 21735)
+++ trunk/uClibc/libc/string/x86_64/memset.S 2008-04-15 08:23:19 UTC (rev 21736)
@@ -53,15 +53,15 @@
imul %rax,%r8
#endif
test $0x7,%edi /* Check for alignment. */
- je 2f
+ jz 2f
.p2align 4
1: /* Align ptr to 8 byte. */
mov %sil,(%rcx)
dec %rdx
inc %rcx
- test $0x7,%ecx
- jne 1b
+ test $0x7,%cl
+ jnz 1b
2: /* Check for really large regions. */
mov %rdx,%rax
@@ -107,7 +107,7 @@
jne 8b
9:
#if BZERO_P
- nop /* huh?? */
+ /* nothing */
#else
/* Load result (only if used as memset). */
mov %rdi,%rax /* start address of destination is result */
Modified: trunk/uClibc/libc/string/x86_64/strcat.S
===================================================================
--- trunk/uClibc/libc/string/x86_64/strcat.S 2008-04-15 01:17:50 UTC (rev 21735)
+++ trunk/uClibc/libc/string/x86_64/strcat.S 2008-04-15 08:23:19 UTC (rev 21736)
@@ -103,7 +103,7 @@
the addition will not result in 0. */
jz 4b /* no NUL found => continue loop */
- .p2align 4 /* Align, it's a jump target. */
+ .p2align 4 /* Align, it is a jump target. */
3: subq $8,%rax /* correct pointer increment. */
testb %cl, %cl /* is first byte NUL? */
Modified: trunk/uClibc/libc/string/x86_64/strcspn.S
===================================================================
--- trunk/uClibc/libc/string/x86_64/strcspn.S 2008-04-15 01:17:50 UTC (rev 21735)
+++ trunk/uClibc/libc/string/x86_64/strcspn.S 2008-04-15 08:23:19 UTC (rev 21736)
@@ -26,7 +26,6 @@
#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)
@@ -63,19 +62,19 @@
movb %cl, (%rsp,%rcx) /* set corresponding byte in skipset table */
movb 1(%rax), %cl /* get byte from skipset */
- testb $0xff, %cl /* is NUL char? */
+ testb %cl, %cl /* is NUL char? */
jz L(1) /* yes => start compare loop */
movb %cl, (%rsp,%rcx) /* set corresponding byte in skipset table */
movb 2(%rax), %cl /* get byte from skipset */
- testb $0xff, %cl /* is NUL char? */
+ testb %cl, %cl /* is NUL char? */
jz L(1) /* yes => start compare loop */
movb %cl, (%rsp,%rcx) /* set corresponding byte in skipset table */
movb 3(%rax), %cl /* get byte from skipset */
addq $4, %rax /* increment skipset pointer */
movb %cl, (%rsp,%rcx) /* set corresponding byte in skipset table */
- testb $0xff, %cl /* is NUL char? */
+ testb %cl, %cl /* is NUL char? */
jnz L(2) /* no => process next dword from skipset */
L(1): leaq -4(%rdx), %rax /* prepare loop */
Modified: trunk/uClibc/libc/string/x86_64/strlen.S
===================================================================
--- trunk/uClibc/libc/string/x86_64/strlen.S 2008-04-15 01:17:50 UTC (rev 21735)
+++ trunk/uClibc/libc/string/x86_64/strlen.S 2008-04-15 08:23:19 UTC (rev 21736)
@@ -98,7 +98,7 @@
the addition will not result in 0. */
jz 4b /* no NUL found => continue loop */
- .p2align 4 /* Align, it's a jump target. */
+ .p2align 4 /* Align, it is a jump target. */
3: subq $8,%rax /* correct pointer increment. */
testb %cl, %cl /* is first byte NUL? */
Modified: trunk/uClibc/libc/string/x86_64/strspn.S
===================================================================
--- trunk/uClibc/libc/string/x86_64/strspn.S 2008-04-15 01:17:50 UTC (rev 21735)
+++ trunk/uClibc/libc/string/x86_64/strspn.S 2008-04-15 08:23:19 UTC (rev 21736)
@@ -57,19 +57,19 @@
movb %cl, (%rsp,%rcx) /* set corresponding byte in stopset table */
movb 1(%rax), %cl /* get byte from stopset */
- testb $0xff, %cl /* is NUL char? */
+ testb %cl, %cl /* is NUL char? */
jz L(1) /* yes => start compare loop */
movb %cl, (%rsp,%rcx) /* set corresponding byte in stopset table */
movb 2(%rax), %cl /* get byte from stopset */
- testb $0xff, %cl /* is NUL char? */
+ testb %cl, %cl /* is NUL char? */
jz L(1) /* yes => start compare loop */
movb %cl, (%rsp,%rcx) /* set corresponding byte in stopset table */
movb 3(%rax), %cl /* get byte from stopset */
addq $4, %rax /* increment stopset pointer */
movb %cl, (%rsp,%rcx) /* set corresponding byte in stopset table */
- testb $0xff, %cl /* is NUL char? */
+ testb %cl, %cl /* is NUL char? */
jnz L(2) /* no => process next dword from stopset */
L(1): leaq -4(%rdx), %rax /* prepare loop */
More information about the uClibc-cvs
mailing list