From: Ulrich Drepper Date: Tue, 7 Apr 2009 14:53:04 +0000 (+0000) Subject: * string/stratcliff.c (do_test): Add memchr tests.. X-Git-Tag: upstream/2.30~13720 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ddba0f17007795ac53ee2f82e6e954dc1a50d104;p=external%2Fglibc.git * string/stratcliff.c (do_test): Add memchr tests.. * sysdeps/x86_64/memchr.S: Fix handling of end of buffer after first read quad word. --- diff --git a/ChangeLog b/ChangeLog index 6a26ed5..5efbf50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-04-07 Ulrich Drepper + + * string/stratcliff.c (do_test): Add memchr tests.. + * sysdeps/x86_64/memchr.S: Fix handling of end of buffer after + first read quad word. + 2009-04-06 Ulrich Drepper * string/strverscmp.c (__strverscmp): Fix last cleanups. diff --git a/localedata/locales/ks_IN@devanagari b/localedata/locales/ks_IN@devanagari index 2e55de7..ebc5234 100644 --- a/localedata/locales/ks_IN@devanagari +++ b/localedata/locales/ks_IN@devanagari @@ -1,11 +1,11 @@ comment_char % escape_char / -% Kashmiri language locale for India. +% Kashmiri(devanagari) language locale for India. % Contributed by Rakesh Pandit and % Pravin Satpute LC_IDENTIFICATION -title "Kashmiri language locale for India" +title "Kashmiri(devanagari) language locale for India" source "" address "" contact "" @@ -32,51 +32,20 @@ category "ks_IN@devanagari:2008";LC_TELEPHONE END LC_IDENTIFICATION LC_CTYPE -copy "i18n" - -translit_start -include "translit_combining";"" -translit_end +copy "ks_IN" END LC_CTYPE LC_COLLATE - -% Copy the template from ISO/IEC 14651 -copy "iso14651_t1" - +copy "ks_IN" END LC_COLLATE LC_MONETARY -% This is the POSIX Locale definition the LC_MONETARY category. -% These are generated based on XML base Locale difintion file -% for IBM Class for Unicode/Java -% -int_curr_symbol "" -currency_symbol "" -mon_decimal_point "" -mon_thousands_sep "" -mon_grouping 3 -positive_sign "" -negative_sign "" -int_frac_digits 2 -frac_digits 2 -p_cs_precedes 1 -p_sep_by_space 1 -n_cs_precedes 1 -n_sep_by_space 1 -p_sign_posn 1 -n_sign_posn 1 -% +copy "ks_IN" END LC_MONETARY LC_NUMERIC -% This is the POSIX Locale definition for the LC_NUMERIC category. -% -decimal_point "" -thousands_sep "" -grouping 3 -% +copy "ks_IN" END LC_NUMERIC @@ -185,12 +154,7 @@ END LC_NAME LC_ADDRESS -postal_fmt "/ -" - -country_ab2 "" -country_ab3 "" -country_num 356 +copy "ks_IN" END LC_ADDRESS diff --git a/string/stratcliff.c b/string/stratcliff.c index 77fe2bc..f90616c 100644 --- a/string/stratcliff.c +++ b/string/stratcliff.c @@ -1,5 +1,5 @@ /* Test for string function add boundaries of usable memory. - Copyright (C) 1996,1997,1999-2002,2003,2007 Free Software Foundation, Inc. + Copyright (C) 1996,1997,1999-2003,2007, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -46,6 +46,7 @@ # define STPNCPY stpncpy # define MEMCPY memcpy # define MEMPCPY mempcpy +# define MEMCHR memchr #endif @@ -205,6 +206,37 @@ do_test (void) } } + /* memchr test */ + for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer) + { + for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle) + { + adr[middle] = L('V'); + + CHAR *cp = MEMCHR (&adr[outer], L('V'), 3 * size); + + if (cp - &adr[outer] != middle - outer) + { + printf ("%s flunked for outer = %d, middle = %d\n", + STRINGIFY (MEMCHR), outer, middle); + result = 1; + } + + adr[middle] = L('T'); + } + } + for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer) + { + CHAR *cp = MEMCHR (&adr[outer], L('V'), nchars - outer); + + if (cp != NULL) + { + printf ("%s flunked for outer = %d\n", + STRINGIFY (MEMCHR), outer); + result = 1; + } + } + /* This function only exists for single-byte characters. */ #ifndef WCSTEST /* rawmemchr test */ diff --git a/sysdeps/x86_64/memchr.S b/sysdeps/x86_64/memchr.S index 15484cb..644362d 100644 --- a/sysdeps/x86_64/memchr.S +++ b/sysdeps/x86_64/memchr.S @@ -37,12 +37,12 @@ ENTRY (memchr) shl %cl, %esi pmovmskb %xmm0, %ecx andl %esi, %ecx - movl $0, %esi + movl $16, %esi jnz 1f cmpq %rsi, %rdx jle 3f -2: movdqa 16(%rdi,%rsi), %xmm0 +2: movdqa (%rdi,%rsi), %xmm0 leaq 16(%rsi), %rsi pcmpeqb %xmm1, %xmm0 pmovmskb %xmm0, %ecx @@ -54,10 +54,10 @@ ENTRY (memchr) 3: xorl %eax, %eax ret -1: leaq (%rdi,%rsi), %rax +1: leaq -16(%rdi,%rsi), %rax bsfl %ecx, %ecx addq %rcx, %rax - addq %rcx, %rsi + leaq -16(%rsi,%rcx), %rsi cmpq %rsi, %rdx jle 3b ret