This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: Align labels and simplify unwind info in strcmp-ssse3.S


Hi,

This patch aligns jump targets and simplifies unwind info in
strcmp-ssse3.S.  Before the fix, I got

Breakpoint 4, __strncmp_ssse3 ()
    at ../sysdeps/i386/i686/multiarch/strcmp-ssse3.S:2110
2110		POP	(%esi)
(gdb) bt
#0  __strncmp_ssse3 () at ../sysdeps/i386/i686/multiarch/strcmp-ssse3.S:2110
#1  0x0000007f in ?? ()
#2  0x00000000 in ?? ()
(gdb) 

After the fix, I got

Breakpoint 5, __strncmp_ssse3 ()
    at ../sysdeps/i386/i686/multiarch/strcmp-ssse3.S:2059
2059		POP	(%edi)
(gdb) bt
#0  __strncmp_ssse3 () at ../sysdeps/i386/i686/multiarch/strcmp-ssse3.S:2059
#1  0x0804b12e in do_one_test (impl=0x804e424, 
    s1=0xf7e79fe8 "\001\030/F]t\f#:Qh\177\027.E\\s\v\"9Pg~\026", 
    s2=0xf7e76fe0 "\001\030/F]t\f#:Qh\177\027.E\\s\v\"9Pg~\026ZZZZZZZZ",
n=24, 
    exp_result=0) at test-strncmp.c:89
#2  0x0804b657 in do_test_limit (align1=8, align2=0, len=25, n=24, 
    max_char=127, exp_result=0) at test-strncmp.c:231
#3  0x0804c747 in main () at test-strncmp.c:490
(gdb) 



H.J.
---
2010-02-16  H.J. Lu  <hongjiu.lu@intel.com>

	* sysdeps/i386/i686/multiarch/strcmp-ssse3.S (RETURN): New.
	(less16bytes): Use it.
	(Byte0): Likewise.
	(Byte1): Likewise.
	(Byte2): Likewise.
	(Byte3): Likewise.
	(Byte4): Likewise.
	(Byte5): Likewise.
	(Byte6): Likewise.
	(Byte6): Likewise.
	(Byte6): Likewise.
	(2next_8_bytes): Likewise.
	(neq): Likewise.
	(neq): Aligned to 16byte.
	(more8byteseq): Likewise.
	(less16bytes_sncmp): Likewise.

diff --git a/sysdeps/i386/i686/multiarch/strcmp-ssse3.S b/sysdeps/i386/i686/multiarch/strcmp-ssse3.S
index 338b003..f16ea58 100644
--- a/sysdeps/i386/i686/multiarch/strcmp-ssse3.S
+++ b/sysdeps/i386/i686/multiarch/strcmp-ssse3.S
@@ -40,6 +40,8 @@
 # endif
 # define STR1		4
 # define STR2		STR1+4
+# define RETURN		ret
+
 # define UPDATE_STRNCMP_COUNTER
 #else
 # ifndef STRCMP
@@ -48,6 +50,7 @@
 # define STR1		8
 # define STR2		STR1+4
 # define CNT		STR2+4
+# define RETURN		POP (%ebp); ret; CFI_PUSH (%ebp)
 
 # define UPDATE_STRNCMP_COUNTER				\
 	/* calculate left number to compare */		\
@@ -160,9 +163,6 @@ L(crosspage):
 	PUSH	(%ebx)
 	PUSH	(%edi)
 	PUSH	(%esi)
-#ifdef USE_AS_STRNCMP
-	cfi_remember_state
-#endif
 
 	movl	%edx, %edi
 	movl	%eax, %ecx
@@ -1913,15 +1913,9 @@ L(less16bytes):
 	movzx	7(%edx), %eax
 
 	sub	%ecx, %eax
-#ifdef USE_AS_STRNCMP
-	POP	(%ebp)
-#endif
-	ret
+	RETURN
 
 	.p2align 4
-#ifdef USE_AS_STRNCMP
-	CFI_PUSH (%ebp)
-#endif
 L(Byte0):
 #ifdef USE_AS_STRNCMP
 	cmp	$0, %ebp
@@ -1931,15 +1925,9 @@ L(Byte0):
 	movzx	(%edx), %eax
 
 	sub	%ecx, %eax
-#ifdef USE_AS_STRNCMP
-	POP	(%ebp)
-#endif
-	ret
+	RETURN
 
 	.p2align 4
-#ifdef USE_AS_STRNCMP
-	CFI_PUSH (%ebp)
-#endif
 L(Byte1):
 #ifdef USE_AS_STRNCMP
 	cmp	$1, %ebp
@@ -1949,15 +1937,9 @@ L(Byte1):
 	movzx	1(%edx), %eax
 
 	sub	%ecx, %eax
-#ifdef USE_AS_STRNCMP
-	POP	(%ebp)
-#endif
-	ret
+	RETURN
 
 	.p2align 4
-#ifdef USE_AS_STRNCMP
-	CFI_PUSH (%ebp)
-#endif
 L(Byte2):
 #ifdef USE_AS_STRNCMP
 	cmp	$2, %ebp
@@ -1967,15 +1949,9 @@ L(Byte2):
 	movzx	2(%edx), %eax
 
 	sub	%ecx, %eax
-#ifdef USE_AS_STRNCMP
-	POP	(%ebp)
-#endif
-	ret
+	RETURN
 
 	.p2align 4
-#ifdef USE_AS_STRNCMP
-	CFI_PUSH (%ebp)
-#endif
 L(Byte3):
 #ifdef USE_AS_STRNCMP
 	cmp	$3, %ebp
@@ -1985,15 +1961,9 @@ L(Byte3):
 	movzx	3(%edx), %eax
 
 	sub	%ecx, %eax
-#ifdef USE_AS_STRNCMP
-	POP	(%ebp)
-#endif
-	ret
+	RETURN
 
 	.p2align 4
-#ifdef USE_AS_STRNCMP
-	CFI_PUSH (%ebp)
-#endif
 L(Byte4):
 #ifdef USE_AS_STRNCMP
 	cmp	$4, %ebp
@@ -2003,15 +1973,9 @@ L(Byte4):
 	movzx	4(%edx), %eax
 
 	sub	%ecx, %eax
-#ifdef USE_AS_STRNCMP
-	POP	(%ebp)
-#endif
-	ret
+	RETURN
 
 	.p2align 4
-#ifdef USE_AS_STRNCMP
-	CFI_PUSH (%ebp)
-#endif
 L(Byte5):
 #ifdef USE_AS_STRNCMP
 	cmp	$5, %ebp
@@ -2021,15 +1985,9 @@ L(Byte5):
 	movzx	5(%edx), %eax
 
 	sub	%ecx, %eax
-#ifdef USE_AS_STRNCMP
-	POP	(%ebp)
-#endif
-	ret
+	RETURN
 
 	.p2align 4
-#ifdef USE_AS_STRNCMP
-	CFI_PUSH (%ebp)
-#endif
 L(Byte6):
 #ifdef USE_AS_STRNCMP
 	cmp	$6, %ebp
@@ -2039,15 +1997,9 @@ L(Byte6):
 	movzx	6(%edx), %eax
 
 	sub	%ecx, %eax
-#ifdef USE_AS_STRNCMP
-	POP	(%ebp)
-#endif
-	ret
+	RETURN
 
 	.p2align 4
-#ifdef USE_AS_STRNCMP
-	CFI_PUSH (%ebp)
-#endif
 L(2next_8_bytes):
 	add	$8, %eax
 	add	$8, %edx
@@ -2086,26 +2038,22 @@ L(2next_8_bytes):
 	movzx	7(%edx), %eax
 
 	sub	%ecx, %eax
-#ifdef USE_AS_STRNCMP
-	POP	(%ebp)
-#endif
-	ret
+	RETURN
 
-#ifdef USE_AS_STRNCMP
-	CFI_PUSH (%ebp)
-#endif
+	.p2align 4
 L(neq):
 	mov	$1, %eax
 	ja	L(neq_bigger)
 	neg	%eax
 L(neq_bigger):
-#ifdef USE_AS_STRNCMP
-	POP	(%ebp)
-#endif
-	ret
+	RETURN
 
 #ifdef USE_AS_STRNCMP
-	cfi_remember_state
+	CFI_PUSH (%ebx)
+	CFI_PUSH (%edi)
+	CFI_PUSH (%esi)
+
+	.p2align 4
 L(more8byteseq):
 	POP	(%esi)
 	POP	(%edi)
@@ -2122,6 +2070,8 @@ L(eq):
 
 #ifdef USE_AS_STRNCMP
 	CFI_PUSH (%ebp)
+
+	.p2align 4
 L(less16bytes_sncmp):
 	test	%ebp, %ebp
 	jz	L(eq)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]