summaryrefslogtreecommitdiff
path: root/sysdeps/i386/i586/strlen.S
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1996-09-11 01:52:48 +0000
committerUlrich Drepper <drepper@redhat.com>1996-09-11 01:52:48 +0000
commitda74e90200dd19f2f40a47135759eab62e8bfce7 (patch)
tree4b55ba7c99d3de4d313cf9180ff58ef525f1900b /sysdeps/i386/i586/strlen.S
parent569c558c880779d33c6642662d1aa57dff697244 (diff)
update from main archive 960910
Wed Sep 11 02:57:31 1996 Ulrich Drepper <drepper@cygnus.com> * configure.in: Quote $add_ons argument in loop to generated prefices. Tue Sep 10 20:43:45 1996 Ulrich Drepper <drepper@cygnus.com> * db/makedb.c: Include <locale.h>. Reported by Fila Kolodny. Tue Sep 10 13:49:08 1996 Ulrich Drepper <drepper@cygnus.com> * inet/herrno.c: Initialize `h_errno' so that we can provide alias. * Makefile (version-info.h): Fix typo in shell script. * sysdeps/i386/i586/strlen.S: Optimize startup code a bit. * sysdeps/i386/i586/strchr.S: Likewise.
Diffstat (limited to 'sysdeps/i386/i586/strlen.S')
-rw-r--r--sysdeps/i386/i586/strlen.S26
1 files changed, 13 insertions, 13 deletions
diff --git a/sysdeps/i386/i586/strlen.S b/sysdeps/i386/i586/strlen.S
index 15d01947d4..1e17131389 100644
--- a/sysdeps/i386/i586/strlen.S
+++ b/sysdeps/i386/i586/strlen.S
@@ -42,32 +42,31 @@ Boston, MA 02111-1307, USA. */
.text
ENTRY(strlen)
movl 4(%esp), %eax /* get string pointer */
+ movl $3, %edx /* load mask (= 3) */
- movl %eax, %ecx /* duplicate it */
- andl $3, %ecx /* mask alignment bits */
+ andl %eax, %edx /* separate last two bits of address */
- jz L11 /* aligned => start loop */
+ jz L1 /* aligned => start loop */
+ jp L0 /* exactly two bits set */
- cmpb %ch, (%eax) /* is byte NUL? */
+ cmpb %dh, (%eax) /* is byte NUL? */
je L2 /* yes => return */
incl %eax /* increment pointer */
- cmpl $3, %ecx /* was alignment = 3? */
+ xorl $3, %edx /* was alignment = 3? */
- je L11 /* yes => now it is aligned and start loop */
+ jz L1 /* yes => now it is aligned and start loop */
- cmpb %ch, (%eax) /* is byte NUL? */
+L0: cmpb %dh, (%eax) /* is byte NUL? */
je L2 /* yes => return */
incl %eax /* increment pointer */
- cmpl $2, %ecx /* was alignment = 2? */
- je L11 /* yes => now it is aligned and start loop */
-
- cmpb %ch, (%eax) /* is byte NUL? */
+ cmpb %dh, (%eax) /* is byte NUL? */
je L2 /* yes => return */
incl %eax /* increment pointer */
+ xorl %edx, %edx /* We need %edx == 0 for later */
/* We exit the loop if adding MAGIC_BITS to LONGWORD fails to
change any of the hole bits of LONGWORD.
@@ -88,8 +87,9 @@ ENTRY(strlen)
into bit 16. Similarly, there will be a carry into bit
24. If one of bits 24-31 is set, there will be a carry
into bit 32 (=carry flag), so all of the hole bits will
- be changed. */
-L11: xorl %edx, %edx /* We need %edx == 0 for later */
+ be changed.
+
+ Note: %edx == 0 in any case here. */
L1:
movl (%eax), %ecx /* get word (= 4 bytes) in question */