* string/stratcliff.c (do_test): Add memchr tests..

* sysdeps/x86_64/memchr.S: Fix handling of end of buffer after
	first read quad word.
This commit is contained in:
Ulrich Drepper 2009-04-07 14:53:04 +00:00
parent 4bcb2658ff
commit ddba0f1700
4 changed files with 50 additions and 48 deletions

View File

@ -1,3 +1,9 @@
2009-04-07 Ulrich Drepper <drepper@redhat.com>
* 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 <drepper@redhat.com>
* string/strverscmp.c (__strverscmp): Fix last cleanups.

View File

@ -1,11 +1,11 @@
comment_char %
escape_char /
% Kashmiri language locale for India.
% Kashmiri(devanagari) language locale for India.
% Contributed by Rakesh Pandit <rakesh.pandit@gmail.com> and
% Pravin Satpute <psatpute@redhat.com>
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 "<U0049><U004E><U0052><U0020>"
currency_symbol "<U0930><U0942>"
mon_decimal_point "<U002E>"
mon_thousands_sep "<U002C>"
mon_grouping 3
positive_sign ""
negative_sign "<U002D>"
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 "<U002E>"
thousands_sep "<U002C>"
grouping 3
%
copy "ks_IN"
END LC_NUMERIC
@ -185,12 +154,7 @@ END LC_NAME
LC_ADDRESS
postal_fmt "<U0025><U007A><U0025><U0063><U0025><U0054><U0025><U0073>/
<U0025><U0062><U0025><U0065><U0025><U0072>"
country_ab2 "<U0049><U004E>"
country_ab3 "<U0049><U004E><U0044>"
country_num 356
copy "ks_IN"
END LC_ADDRESS

View File

@ -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 <drepper@cygnus.com>, 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 */

View File

@ -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