diff --git a/ChangeLog b/ChangeLog index 9e7dd959da..9d808048ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-08-11 Siddhesh Poyarekar + + * benchtests/bench-memccpy.c (do_one_test): Remove checks. + * benchtests/bench-memchr.c (do_one_test): Likewise. + * benchtests/bench-memcpy-large.c (do_one_test): Likewise. + * benchtests/bench-memcpy.c (do_one_test): Likewise. + * benchtests/bench-memmove-large.c (do_one_test): Likewise. + * benchtests/bench-memmove.c (do_one_test): Likewise. + * benchtests/bench-memset-large.c (do_one_test): Likewise. + * benchtests/bench-memset.c (do_one_test): Likewise. + * benchtests/bench-string.h (test_init): Remove memsets. + 2017-08-10 Rical Jasan * manual/lang.texi diff --git a/benchtests/bench-memccpy.c b/benchtests/bench-memccpy.c index 754968767c..278de51012 100644 --- a/benchtests/bench-memccpy.c +++ b/benchtests/bench-memccpy.c @@ -58,25 +58,9 @@ static void do_one_test (impl_t *impl, void *dst, const void *src, int c, size_t len, size_t n) { - void *expect = len > n ? NULL : (char *) dst + len; size_t i, iters = INNER_LOOP_ITERS; timing_t start, stop, cur; - if (CALL (impl, dst, src, c, n) != expect) - { - error (0, 0, "Wrong result in function %s %p %p", impl->name, - CALL (impl, dst, src, c, n), expect); - ret = 1; - return; - } - - if (memcmp (dst, src, len > n ? n : len) != 0) - { - error (0, 0, "Wrong result in function %s", impl->name); - ret = 1; - return; - } - TIMING_NOW (start); for (i = 0; i < iters; ++i) { diff --git a/benchtests/bench-memchr.c b/benchtests/bench-memchr.c index 92b5b7f986..59d6eab203 100644 --- a/benchtests/bench-memchr.c +++ b/benchtests/bench-memchr.c @@ -59,20 +59,11 @@ SIMPLE_MEMCHR (const CHAR *s, int c, size_t n) #endif /* !USE_AS_MEMRCHR */ static void -do_one_test (impl_t *impl, const CHAR *s, int c, size_t n, CHAR *exp_res) +do_one_test (impl_t *impl, const CHAR *s, int c, size_t n) { - CHAR *res = CALL (impl, s, c, n); size_t i, iters = INNER_LOOP_ITERS; timing_t start, stop, cur; - if (res != exp_res) - { - error (0, 0, "Wrong result in function %s %p %p", impl->name, - res, exp_res); - ret = 1; - return; - } - TIMING_NOW (start); for (i = 0; i < iters; ++i) { @@ -89,7 +80,6 @@ static void do_test (size_t align, size_t pos, size_t len, int seek_char) { size_t i; - CHAR *result; align &= 7; if ((align + len) * sizeof (CHAR) >= page_size) @@ -109,11 +99,9 @@ do_test (size_t align, size_t pos, size_t len, int seek_char) { buf[align + pos] = seek_char; buf[align + len] = -seek_char; - result = (CHAR *) (buf + align + pos); } else { - result = NULL; buf[align + len] = seek_char; } @@ -121,7 +109,7 @@ do_test (size_t align, size_t pos, size_t len, int seek_char) len, pos, align); FOR_EACH_IMPL (impl, 0) - do_one_test (impl, (CHAR *) (buf + align), seek_char, len, result); + do_one_test (impl, (CHAR *) (buf + align), seek_char, len); putchar ('\n'); } diff --git a/benchtests/bench-memcpy-large.c b/benchtests/bench-memcpy-large.c index 965edf547f..1dea16f4b2 100644 --- a/benchtests/bench-memcpy-large.c +++ b/benchtests/bench-memcpy-large.c @@ -39,26 +39,6 @@ do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, const char *src, size_t i, iters = 16; timing_t start, stop, cur; - /* Must clear the destination buffer updated by the previous run. */ - for (i = 0; i < len; i++) - dst[i] = 0; - - if (CALL (impl, dst, src, len) != MEMCPY_RESULT (dst, len)) - { - error (0, 0, "Wrong result in function %s %p %p", impl->name, - CALL (impl, dst, src, len), MEMCPY_RESULT (dst, len)); - ret = 1; - return; - } - - if (memcmp (dst, src, len) != 0) - { - error (0, 0, "Wrong result in function %s dst \"%s\" src \"%s\"", - impl->name, dst, src); - ret = 1; - return; - } - TIMING_NOW (start); for (i = 0; i < iters; ++i) { diff --git a/benchtests/bench-memcpy.c b/benchtests/bench-memcpy.c index d80c6445e6..af920bc1c1 100644 --- a/benchtests/bench-memcpy.c +++ b/benchtests/bench-memcpy.c @@ -57,26 +57,6 @@ do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, const char *src, size_t i, iters = INNER_LOOP_ITERS; timing_t start, stop, cur; - /* Must clear the destination buffer set by the previous run. */ - for (i = 0; i < len; i++) - dst[i] = 0; - - if (CALL (impl, dst, src, len) != MEMCPY_RESULT (dst, len)) - { - error (0, 0, "Wrong result in function %s %p %p", impl->name, - CALL (impl, dst, src, len), MEMCPY_RESULT (dst, len)); - ret = 1; - return; - } - - if (memcmp (dst, src, len) != 0) - { - error (0, 0, "Wrong result in function %s dst \"%s\" src \"%s\"", - impl->name, dst, src); - ret = 1; - return; - } - TIMING_NOW (start); for (i = 0; i < iters; ++i) { diff --git a/benchtests/bench-memmove-large.c b/benchtests/bench-memmove-large.c index e17cea0a13..5230c6e488 100644 --- a/benchtests/bench-memmove-large.c +++ b/benchtests/bench-memmove-large.c @@ -35,27 +35,6 @@ do_one_test (impl_t *impl, char *dst, char *src, const char *orig_src, size_t i, iters = 16; timing_t start, stop, cur; - /* This also clears the destination buffer updated by the previous - run. */ - memcpy (src, orig_src, len); - - char *res = CALL (impl, dst, src, len); - if (res != dst) - { - error (0, 0, "Wrong result in function %s %p %p", impl->name, - res, dst); - ret = 1; - return; - } - - if (memcmp (dst, orig_src, len) != 0) - { - error (0, 0, "Wrong result in function %s dst \"%s\" src \"%s\"", - impl->name, dst, src); - ret = 1; - return; - } - TIMING_NOW (start); for (i = 0; i < iters; ++i) { diff --git a/benchtests/bench-memmove.c b/benchtests/bench-memmove.c index 4cbaa46bb5..93c58a6c56 100644 --- a/benchtests/bench-memmove.c +++ b/benchtests/bench-memmove.c @@ -70,31 +70,6 @@ do_one_test (impl_t *impl, char *dst, char *src, const char *orig_src, size_t i, iters = INNER_LOOP_ITERS; timing_t start, stop, cur; - /* This also clears the destination buffer set by the previous run. */ - memcpy (src, orig_src, len); -#ifdef TEST_BCOPY - CALL (impl, src, dst, len); -#else - char *res; - - res = CALL (impl, dst, src, len); - if (res != dst) - { - error (0, 0, "Wrong result in function %s %p %p", impl->name, - res, dst); - ret = 1; - return; - } -#endif - - if (memcmp (dst, orig_src, len) != 0) - { - error (0, 0, "Wrong result in function %s dst \"%s\" src \"%s\"", - impl->name, dst, src); - ret = 1; - return; - } - TIMING_NOW (start); for (i = 0; i < iters; ++i) { diff --git a/benchtests/bench-memset-large.c b/benchtests/bench-memset-large.c index 6cfe8a5951..d18a05e59a 100644 --- a/benchtests/bench-memset-large.c +++ b/benchtests/bench-memset-large.c @@ -61,23 +61,6 @@ do_one_test (impl_t *impl, CHAR *s, int c __attribute ((unused)), size_t n) { size_t i, iters = 16; timing_t start, stop, cur; - CHAR *tstbuf = malloc (n * sizeof (*s)); - assert (tstbuf != NULL); - - /* Must clear the destination buffer updated by the previous run. */ - for (i = 0; i < n; i++) - s[i] = 0; - - CHAR *res = CALL (impl, s, c, n); - if (res != s - || SIMPLE_MEMSET (tstbuf, c, n) != tstbuf - || MEMCMP (s, tstbuf, n) != 0) - { - error (0, 0, "Wrong result in function %s", impl->name); - ret = 1; - free (tstbuf); - return; - } TIMING_NOW (start); for (i = 0; i < iters; ++i) @@ -89,8 +72,6 @@ do_one_test (impl_t *impl, CHAR *s, int c __attribute ((unused)), size_t n) TIMING_DIFF (cur, start, stop); TIMING_PRINT_MEAN ((double) cur, (double) iters); - - free (tstbuf); } static void diff --git a/benchtests/bench-memset.c b/benchtests/bench-memset.c index dc7944c596..6b5c57f007 100644 --- a/benchtests/bench-memset.c +++ b/benchtests/bench-memset.c @@ -98,22 +98,6 @@ do_one_test (impl_t *impl, CHAR *s, int c __attribute ((unused)), size_t n) { size_t i, iters = INNER_LOOP_ITERS; timing_t start, stop, cur; - CHAR tstbuf[n]; -#ifdef TEST_BZERO - simple_bzero (tstbuf, n); - CALL (impl, s, n); - if (memcmp (s, tstbuf, n) != 0) -#else - CHAR *res = CALL (impl, s, c, n); - if (res != s - || SIMPLE_MEMSET (tstbuf, c, n) != tstbuf - || MEMCMP (s, tstbuf, n) != 0) -#endif /* !TEST_BZERO */ - { - error (0, 0, "Wrong result in function %s", impl->name); - ret = 1; - return; - } TIMING_NOW (start); for (i = 0; i < iters; ++i) diff --git a/benchtests/bench-string.h b/benchtests/bench-string.h index d76724d27c..3aacfdf83e 100644 --- a/benchtests/bench-string.h +++ b/benchtests/bench-string.h @@ -203,9 +203,6 @@ test_init (void) printf ("Setting seed to 0x%x\n", seed); srandom (seed); } - - memset (buf1, 0xa5, BUF1PAGES * page_size); - memset (buf2, 0x5a, page_size); } #endif /* TEST_MAIN */