diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | string/test-strncmp.c | 41 | ||||
-rw-r--r-- | sysdeps/x86_64/multiarch/strcmp.S | 45 |
4 files changed, 81 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog index 70b6faf20f..8e59560432 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-03-20 H.J. Lu <hongjiu.lu@intel.com> + + [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@gmail.com> [BZ #12587] diff --git a/NEWS b/NEWS index 0bf33f528a..4557b4578a 100644 --- a/NEWS +++ b/NEWS @@ -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 @@ Version 2.14 * 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 diff --git a/string/test-strncmp.c b/string/test-strncmp.c index 3687879c25..11c681e7e1 100644 --- a/string/test-strncmp.c +++ b/string/test-strncmp.c @@ -200,6 +200,27 @@ do_test (size_t align1, size_t align2, size_t len, size_t n, int max_char, } 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 do_random_tests (void) { size_t i, j, n, align1, align2, pos, len1, len2, size; @@ -312,6 +333,25 @@ check1 (void) } } +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_main (void) test_init (); check1 (); + check2 (); printf ("%23s", ""); FOR_EACH_IMPL (impl, 0) diff --git a/sysdeps/x86_64/multiarch/strcmp.S b/sysdeps/x86_64/multiarch/strcmp.S index 1859289572..8879855d92 100644 --- a/sysdeps/x86_64/multiarch/strcmp.S +++ b/sysdeps/x86_64/multiarch/strcmp.S @@ -452,6 +452,7 @@ LABEL(loop_ashr_1_use_sse4_2): 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 @@ LABEL(nibble_ashr_1_use_sse4_2): 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 @@ LABEL(loop_ashr_2_use_sse4_2): 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 @@ LABEL(nibble_ashr_2_use_sse4_2): 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 @@ LABEL(loop_ashr_3_use_sse4_2): 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 @@ LABEL(nibble_ashr_3_use_sse4_2): 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 @@ LABEL(loop_ashr_4_use_sse4_2): 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 @@ LABEL(nibble_ashr_4_use_sse4_2): 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 @@ LABEL(loop_ashr_5_use_sse4_2): 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 @@ LABEL(nibble_ashr_5_use_sse4_2): 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 @@ LABEL(loop_ashr_6_use_sse4_2): 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 @@ LABEL(nibble_ashr_6_use_sse4_2): 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 @@ LABEL(loop_ashr_7_use_sse4_2): 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 @@ LABEL(nibble_ashr_7_use_sse4_2): 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 @@ LABEL(loop_ashr_8_use_sse4_2): 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 @@ LABEL(nibble_ashr_8_use_sse4_2): 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 @@ LABEL(loop_ashr_9_use_sse4_2): 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 @@ LABEL(nibble_ashr_9_use_sse4_2): 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 @@ LABEL(loop_ashr_10_use_sse4_2): 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 @@ LABEL(nibble_ashr_10_use_sse4_2): 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 @@ LABEL(loop_ashr_11_use_sse4_2): 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 @@ LABEL(nibble_ashr_11_use_sse4_2): 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 @@ LABEL(loop_ashr_12_use_sse4_2): 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 @@ LABEL(nibble_ashr_12_use_sse4_2): 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 @@ LABEL(loop_ashr_13_use_sse4_2): 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 @@ LABEL(nibble_ashr_13_use_sse4_2): 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 @@ LABEL(loop_ashr_14_use_sse4_2): 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 @@ LABEL(nibble_ashr_14_use_sse4_2): 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 @@ LABEL(loop_ashr_15_use_sse4_2): 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 @@ LABEL(nibble_ashr_15_use_sse4_2): 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 |