[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r13218 - in /fsf/trunk/libc: ChangeLog NEWS string/test-strncmp.c sysdeps/x86_64/multiarch/strcmp.S



Author: eglibc
Date: Mon Mar 21 08:52:33 2011
New Revision: 13218

Log:
Import glibc-mainline for 2011-03-21

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/NEWS
    fsf/trunk/libc/string/test-strncmp.c
    fsf/trunk/libc/sysdeps/x86_64/multiarch/strcmp.S

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Mon Mar 21 08:52:33 2011
@@ -1,3 +1,11 @@
+2011-03-20  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	[BZ #12597]
+	* string/test-strncmp.c (do_page_test): New function.
+	(check2): Likewise.
+	(test_main): Call check2.
+	* sysdeps/x86_64/multiarch/strcmp.S: Properly cross page boundary.
+
 2011-03-20  Ulrich Drepper  <drepper@xxxxxxxxx>
 
 	[BZ #12587]

Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Mon Mar 21 08:52:33 2011
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes.  2011-3-20
+GNU C Library NEWS -- history of user-visible changes.  2011-3-21
 Copyright (C) 1992-2009, 2010, 2011 Free Software Foundation, Inc.
 See the end for copying conditions.
 
@@ -9,7 +9,7 @@
 
 * The following bugs are resolved with this release:
 
-  11724, 12445, 12454, 12460, 12469, 12489, 12509, 12510, 12583, 12587
+  11724, 12445, 12454, 12460, 12469, 12489, 12509, 12510, 12583, 12587, 12597
 
 Version 2.13
 

Modified: fsf/trunk/libc/string/test-strncmp.c
==============================================================================
--- fsf/trunk/libc/string/test-strncmp.c (original)
+++ fsf/trunk/libc/string/test-strncmp.c Mon Mar 21 08:52:33 2011
@@ -1,5 +1,5 @@
 /* Test and measure strncmp functions.
-   Copyright (C) 1999, 2002, 2003, 2010 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2003, 2010, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jakub Jelinek <jakub@xxxxxxxxxx>, 1999.
 
@@ -108,13 +108,13 @@
       s2 = (char*)(buf2 + page_size);
       if (HP_TIMING_AVAIL)
 	printf ("Length %4zd/%4zd:", len, n);
-	
+
       FOR_EACH_IMPL (impl, 0)
 	do_one_test (impl, s1, s2, n, 0);
 
       if (HP_TIMING_AVAIL)
 	putchar ('\n');
-	
+
       return;
     }
 
@@ -124,13 +124,13 @@
 
   s1 = (char*)(buf1 + page_size - n);
   s2 = (char*)(buf2 + page_size - n);
-  
+
   if (align1 < align_n)
     s1 -= (align_n - align1);
-    
+
   if (align2 < align_n)
     s2 -= (align_n - align2);
-    
+
   for (i = 0; i < n; i++)
     s1[i] = s2[i] = 1 + 23 * i % max_char;
 
@@ -197,6 +197,27 @@
 
   if (HP_TIMING_AVAIL)
     putchar ('\n');
+}
+
+static void
+do_page_test (size_t offset1, size_t offset2, char *s2)
+{
+  char *s1;
+  int exp_result;
+
+  if (offset1 >= page_size || offset2 >= page_size)
+    return;
+
+  s1 = (char *) (buf1 + offset1);
+  s2 += offset2;
+
+  exp_result= *s1;
+
+  FOR_EACH_IMPL (impl, 0)
+    {
+      check_result (impl, s1, s2, page_size, -exp_result);
+      check_result (impl, s2, s1, page_size, exp_result);
+    }
 }
 
 static void
@@ -312,6 +333,25 @@
     }
 }
 
+static void
+check2 (void)
+{
+  size_t i;
+  char *s1, *s2;
+
+  s1 = (char *) buf1;
+  for (i = 0; i < page_size - 1; i++)
+    s1[i] = 23;
+  s1[i] = 0;
+
+  s2 = strdup (s1);
+
+  for (i = 0; i < 64; ++i)
+    do_page_test (3990 + i, 2635, s2);
+
+  free (s2);
+}
+
 int
 test_main (void)
 {
@@ -320,6 +360,7 @@
   test_init ();
 
   check1 ();
+  check2 ();
 
   printf ("%23s", "");
   FOR_EACH_IMPL (impl, 0)
@@ -361,7 +402,7 @@
       do_test (2 * i, i, 8 << i, 16 << i, 255, 0);
       do_test (2 * i, i, 8 << i, 16 << i, 255, 1);
     }
-    
+
   do_test_limit (0, 0, 0, 0, 127, 0);
   do_test_limit (4, 0, 21, 20, 127, 0);
   do_test_limit (0, 4, 21, 20, 127, 0);

Modified: fsf/trunk/libc/sysdeps/x86_64/multiarch/strcmp.S
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/multiarch/strcmp.S (original)
+++ fsf/trunk/libc/sysdeps/x86_64/multiarch/strcmp.S Mon Mar 21 08:52:33 2011
@@ -452,6 +452,7 @@
 	add	$16, %r10
 	jg	LABEL(nibble_ashr_1_use_sse4_2)
 
+LABEL(nibble_ashr_1_use_sse4_2_restart):
 	movdqa	(%rdi, %rdx), %xmm0
 	palignr $1, -16(%rdi, %rdx), %xmm0
 # if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
@@ -499,7 +500,7 @@
 	jae	LABEL(nibble_ashr_use_sse4_2_exit)
 # endif
 	cmp	$14, %ecx
-	ja	LABEL(loop_ashr_1_use_sse4_2)
+	ja	LABEL(nibble_ashr_1_use_sse4_2_restart)
 
 	jmp	LABEL(nibble_ashr_use_sse4_2_exit)
 
@@ -544,6 +545,7 @@
 	add	$16, %r10
 	jg	LABEL(nibble_ashr_2_use_sse4_2)
 
+LABEL(nibble_ashr_2_use_sse4_2_restart):
 	movdqa	(%rdi, %rdx), %xmm0
 	palignr $2, -16(%rdi, %rdx), %xmm0
 # if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
@@ -591,7 +593,7 @@
 	jae	LABEL(nibble_ashr_use_sse4_2_exit)
 # endif
 	cmp	$13, %ecx
-	ja	LABEL(loop_ashr_2_use_sse4_2)
+	ja	LABEL(nibble_ashr_2_use_sse4_2_restart)
 
 	jmp	LABEL(nibble_ashr_use_sse4_2_exit)
 
@@ -636,6 +638,7 @@
 	add	$16, %r10
 	jg	LABEL(nibble_ashr_3_use_sse4_2)
 
+LABEL(nibble_ashr_3_use_sse4_2_restart):
 	movdqa	(%rdi, %rdx), %xmm0
 	palignr $3, -16(%rdi, %rdx), %xmm0
 # if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
@@ -683,7 +686,7 @@
 	jae	LABEL(nibble_ashr_use_sse4_2_exit)
 # endif
 	cmp	$12, %ecx
-	ja	LABEL(loop_ashr_3_use_sse4_2)
+	ja	LABEL(nibble_ashr_3_use_sse4_2_restart)
 
 	jmp	LABEL(nibble_ashr_use_sse4_2_exit)
 
@@ -729,6 +732,7 @@
 	add	$16, %r10
 	jg	LABEL(nibble_ashr_4_use_sse4_2)
 
+LABEL(nibble_ashr_4_use_sse4_2_restart):
 	movdqa	(%rdi, %rdx), %xmm0
 	palignr $4, -16(%rdi, %rdx), %xmm0
 # if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
@@ -776,7 +780,7 @@
 	jae	LABEL(nibble_ashr_use_sse4_2_exit)
 # endif
 	cmp	$11, %ecx
-	ja	LABEL(loop_ashr_4_use_sse4_2)
+	ja	LABEL(nibble_ashr_4_use_sse4_2_restart)
 
 	jmp	LABEL(nibble_ashr_use_sse4_2_exit)
 
@@ -822,6 +826,7 @@
 	add	$16, %r10
 	jg	LABEL(nibble_ashr_5_use_sse4_2)
 
+LABEL(nibble_ashr_5_use_sse4_2_restart):
 	movdqa	(%rdi, %rdx), %xmm0
 	palignr $5, -16(%rdi, %rdx), %xmm0
 # if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
@@ -870,7 +875,7 @@
 	jae	LABEL(nibble_ashr_use_sse4_2_exit)
 # endif
 	cmp	$10, %ecx
-	ja	LABEL(loop_ashr_5_use_sse4_2)
+	ja	LABEL(nibble_ashr_5_use_sse4_2_restart)
 
 	jmp	LABEL(nibble_ashr_use_sse4_2_exit)
 
@@ -916,6 +921,7 @@
 	add	$16, %r10
 	jg	LABEL(nibble_ashr_6_use_sse4_2)
 
+LABEL(nibble_ashr_6_use_sse4_2_restart):
 	movdqa	(%rdi, %rdx), %xmm0
 	palignr $6, -16(%rdi, %rdx), %xmm0
 # if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
@@ -963,7 +969,7 @@
 	jae	LABEL(nibble_ashr_use_sse4_2_exit)
 # endif
 	cmp	$9, %ecx
-	ja	LABEL(loop_ashr_6_use_sse4_2)
+	ja	LABEL(nibble_ashr_6_use_sse4_2_restart)
 
 	jmp	LABEL(nibble_ashr_use_sse4_2_exit)
 
@@ -1009,6 +1015,7 @@
 	add	$16, %r10
 	jg	LABEL(nibble_ashr_7_use_sse4_2)
 
+LABEL(nibble_ashr_7_use_sse4_2_restart):
 	movdqa	(%rdi, %rdx), %xmm0
 	palignr $7, -16(%rdi, %rdx), %xmm0
 # if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
@@ -1056,7 +1063,7 @@
 	jae	LABEL(nibble_ashr_use_sse4_2_exit)
 # endif
 	cmp	$8, %ecx
-	ja	LABEL(loop_ashr_7_use_sse4_2)
+	ja	LABEL(nibble_ashr_7_use_sse4_2_restart)
 
 	jmp	LABEL(nibble_ashr_use_sse4_2_exit)
 
@@ -1102,6 +1109,7 @@
 	add	$16, %r10
 	jg	LABEL(nibble_ashr_8_use_sse4_2)
 
+LABEL(nibble_ashr_8_use_sse4_2_restart):
 	movdqa	(%rdi, %rdx), %xmm0
 	palignr $8, -16(%rdi, %rdx), %xmm0
 # if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
@@ -1149,7 +1157,7 @@
 	jae	LABEL(nibble_ashr_use_sse4_2_exit)
 # endif
 	cmp	$7, %ecx
-	ja	LABEL(loop_ashr_8_use_sse4_2)
+	ja	LABEL(nibble_ashr_8_use_sse4_2_restart)
 
 	jmp	LABEL(nibble_ashr_use_sse4_2_exit)
 
@@ -1195,6 +1203,7 @@
 	add	$16, %r10
 	jg	LABEL(nibble_ashr_9_use_sse4_2)
 
+LABEL(nibble_ashr_9_use_sse4_2_restart):
 	movdqa	(%rdi, %rdx), %xmm0
 
 	palignr $9, -16(%rdi, %rdx), %xmm0
@@ -1243,7 +1252,7 @@
 	jae	LABEL(nibble_ashr_use_sse4_2_exit)
 # endif
 	cmp	$6, %ecx
-	ja	LABEL(loop_ashr_9_use_sse4_2)
+	ja	LABEL(nibble_ashr_9_use_sse4_2_restart)
 
 	jmp	LABEL(nibble_ashr_use_sse4_2_exit)
 
@@ -1289,6 +1298,7 @@
 	add	$16, %r10
 	jg	LABEL(nibble_ashr_10_use_sse4_2)
 
+LABEL(nibble_ashr_10_use_sse4_2_restart):
 	movdqa	(%rdi, %rdx), %xmm0
 	palignr $10, -16(%rdi, %rdx), %xmm0
 # if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
@@ -1336,7 +1346,7 @@
 	jae	LABEL(nibble_ashr_use_sse4_2_exit)
 # endif
 	cmp	$5, %ecx
-	ja	LABEL(loop_ashr_10_use_sse4_2)
+	ja	LABEL(nibble_ashr_10_use_sse4_2_restart)
 
 	jmp	LABEL(nibble_ashr_use_sse4_2_exit)
 
@@ -1382,6 +1392,7 @@
 	add	$16, %r10
 	jg	LABEL(nibble_ashr_11_use_sse4_2)
 
+LABEL(nibble_ashr_11_use_sse4_2_restart):
 	movdqa	(%rdi, %rdx), %xmm0
 	palignr $11, -16(%rdi, %rdx), %xmm0
 # if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
@@ -1429,7 +1440,7 @@
 	jae	LABEL(nibble_ashr_use_sse4_2_exit)
 # endif
 	cmp	$4, %ecx
-	ja	LABEL(loop_ashr_11_use_sse4_2)
+	ja	LABEL(nibble_ashr_11_use_sse4_2_restart)
 
 	jmp	LABEL(nibble_ashr_use_sse4_2_exit)
 
@@ -1475,6 +1486,7 @@
 	add	$16, %r10
 	jg	LABEL(nibble_ashr_12_use_sse4_2)
 
+LABEL(nibble_ashr_12_use_sse4_2_restart):
 	movdqa	(%rdi, %rdx), %xmm0
 	palignr $12, -16(%rdi, %rdx), %xmm0
 # if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
@@ -1522,7 +1534,7 @@
 	jae	LABEL(nibble_ashr_use_sse4_2_exit)
 # endif
 	cmp	$3, %ecx
-	ja	LABEL(loop_ashr_12_use_sse4_2)
+	ja	LABEL(nibble_ashr_12_use_sse4_2_restart)
 
 	jmp	LABEL(nibble_ashr_use_sse4_2_exit)
 
@@ -1569,6 +1581,7 @@
 	add	$16, %r10
 	jg	LABEL(nibble_ashr_13_use_sse4_2)
 
+LABEL(nibble_ashr_13_use_sse4_2_restart):
 	movdqa	(%rdi, %rdx), %xmm0
 	palignr $13, -16(%rdi, %rdx), %xmm0
 # if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
@@ -1616,7 +1629,7 @@
 	jae	LABEL(nibble_ashr_use_sse4_2_exit)
 # endif
 	cmp	$2, %ecx
-	ja	LABEL(loop_ashr_13_use_sse4_2)
+	ja	LABEL(nibble_ashr_13_use_sse4_2_restart)
 
 	jmp	LABEL(nibble_ashr_use_sse4_2_exit)
 
@@ -1663,6 +1676,7 @@
 	add	$16, %r10
 	jg	LABEL(nibble_ashr_14_use_sse4_2)
 
+LABEL(nibble_ashr_14_use_sse4_2_restart):
 	movdqa	(%rdi, %rdx), %xmm0
 	palignr $14, -16(%rdi, %rdx), %xmm0
 # if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
@@ -1710,7 +1724,7 @@
 	jae	LABEL(nibble_ashr_use_sse4_2_exit)
 # endif
 	cmp	$1, %ecx
-	ja	LABEL(loop_ashr_14_use_sse4_2)
+	ja	LABEL(nibble_ashr_14_use_sse4_2_restart)
 
 	jmp	LABEL(nibble_ashr_use_sse4_2_exit)
 
@@ -1759,6 +1773,7 @@
 	add	$16, %r10
 	jg	LABEL(nibble_ashr_15_use_sse4_2)
 
+LABEL(nibble_ashr_15_use_sse4_2_restart):
 	movdqa	(%rdi, %rdx), %xmm0
 	palignr $15, -16(%rdi, %rdx), %xmm0
 # if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
@@ -1806,7 +1821,7 @@
 	jae	LABEL(nibble_ashr_use_sse4_2_exit)
 # endif
 	cmp	$0, %ecx
-	ja	LABEL(loop_ashr_15_use_sse4_2)
+	ja	LABEL(nibble_ashr_15_use_sse4_2_restart)
 
 LABEL(nibble_ashr_use_sse4_2_exit):
 # if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L