1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

Handle page boundaries in x86 SSE4.2 strncmp.

This commit is contained in:
H.J. Lu
2011-03-21 05:35:38 -04:00
committed by Ulrich Drepper
parent 2a11560107
commit c97a1282a4
4 changed files with 81 additions and 17 deletions

View File

@ -199,6 +199,27 @@ do_test (size_t align1, size_t align2, size_t len, size_t n, int max_char,
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
do_random_tests (void)
{
@ -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)