about summary refs log tree commit diff
path: root/string/test-strncmp.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
committerUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
commita334319f6530564d22e775935d9c91663623a1b4 (patch)
treeb5877475619e4c938e98757d518bb1e9cbead751 /string/test-strncmp.c
parent0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (diff)
downloadglibc-a334319f6530564d22e775935d9c91663623a1b4.tar.gz
glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.xz
glibc-a334319f6530564d22e775935d9c91663623a1b4.zip
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
Diffstat (limited to 'string/test-strncmp.c')
-rw-r--r--string/test-strncmp.c85
1 files changed, 4 insertions, 81 deletions
diff --git a/string/test-strncmp.c b/string/test-strncmp.c
index 5adf0eb311..431b64d6af 100644
--- a/string/test-strncmp.c
+++ b/string/test-strncmp.c
@@ -86,65 +86,6 @@ do_one_test (impl_t *impl, const char *s1, const char *s2, size_t n,
 }
 
 static void
-do_test_limit (size_t align1, size_t align2, size_t len, size_t n, int max_char,
-	 int exp_result)
-{
-  size_t i, align_n;
-  char *s1, *s2;
-
-  if (n == 0)
-    {
-      s1 = (char*)(buf1 + page_size);
-      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;
-    }
-
-  align1 &= 15;
-  align2 &= 15;
-  align_n = (page_size - n) & 15;
-
-  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;
-
-  if (len < n)
-    {
-      s1[len] = 0;
-      s2[len] = 0;
-      if (exp_result < 0)
-	s2[len] = 32;
-      else if (exp_result > 0)
-	s1[len] = 64;
-    }
-
-  if (HP_TIMING_AVAIL)
-    printf ("Length %4zd/%4zd, alignment %2zd/%2zd:", len, n, align1, align2);
-
-  FOR_EACH_IMPL (impl, 0)
-    do_one_test (impl, s1, s2, n, exp_result);
-
-  if (HP_TIMING_AVAIL)
-    putchar ('\n');
-}
-
-static void
 do_test (size_t align1, size_t align2, size_t len, size_t n, int max_char,
 	 int exp_result)
 {
@@ -162,8 +103,8 @@ do_test (size_t align1, size_t align2, size_t len, size_t n, int max_char,
   if (align2 + n + 1 >= page_size)
     return;
 
-  s1 = (char*)(buf1 + align1);
-  s2 = (char*)(buf2 + align2);
+  s1 = buf1 + align1;
+  s2 = buf2 + align2;
 
   for (i = 0; i < n; i++)
     s1[i] = s2[i] = 1 + 23 * i % max_char;
@@ -183,7 +124,7 @@ do_test (size_t align1, size_t align2, size_t len, size_t n, int max_char,
     printf ("Length %4zd/%4zd, alignment %2zd/%2zd:", len, n, align1, align2);
 
   FOR_EACH_IMPL (impl, 0)
-    do_one_test (impl, (char*)s1, (char*)s2, n, exp_result);
+    do_one_test (impl, s1, s2, n, exp_result);
 
   if (HP_TIMING_AVAIL)
     putchar ('\n');
@@ -267,7 +208,7 @@ do_random_tests (void)
 
       FOR_EACH_IMPL (impl, 1)
 	{
-	  r = CALL (impl, (char*)(p1 + align1), (char*)(p2 + align2), size);
+	  r = CALL (impl, p1 + align1, p2 + align2, size);
 	  /* Test whether on 64-bit architectures where ABI requires
 	     callee to promote has the promotion been done.  */
 	  asm ("" : "=g" (r) : "0" (r));
@@ -330,24 +271,6 @@ test_main (void)
       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);
-  do_test_limit (8, 0, 25, 24, 127, 0);
-  do_test_limit (0, 8, 25, 24, 127, 0);
-
-  for (i = 0; i < 8; ++i)
-    {
-      do_test_limit (0, 0, 17 - i, 16 - i, 127, 0);
-      do_test_limit (0, 0, 17 - i, 16 - i, 255, 0);
-      do_test_limit (0, 0, 15 - i, 16 - i, 127, 0);
-      do_test_limit (0, 0, 15 - i, 16 - i, 127, 1);
-      do_test_limit (0, 0, 15 - i, 16 - i, 127, -1);
-      do_test_limit (0, 0, 15 - i, 16 - i, 255, 0);
-      do_test_limit (0, 0, 15 - i, 16 - i, 255, 1);
-      do_test_limit (0, 0, 15 - i, 16 - i, 255, -1);
-    }
 
   do_random_tests ();
   return ret;