about summary refs log tree commit diff
path: root/benchtests/bench-bzero-large.c
diff options
context:
space:
mode:
Diffstat (limited to 'benchtests/bench-bzero-large.c')
-rw-r--r--benchtests/bench-bzero-large.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/benchtests/bench-bzero-large.c b/benchtests/bench-bzero-large.c
index f2e2e981b7..cfc7b81cdf 100644
--- a/benchtests/bench-bzero-large.c
+++ b/benchtests/bench-bzero-large.c
@@ -17,7 +17,11 @@
    <https://www.gnu.org/licenses/>.  */
 
 #define TEST_MAIN
-#define TEST_NAME "bzero"
+#ifdef DO_MEMSET
+# define TEST_NAME "memset"
+#else
+# define TEST_NAME "bzero"
+#endif
 #define START_SIZE (128 * 1024)
 #define MIN_PAGE_SIZE (getpagesize () + 64 * 1024 * 1024)
 #define TIMEOUT (20 * 60)
@@ -25,6 +29,14 @@
 
 #include "json-lib.h"
 
+#ifdef DO_MEMSET
+void *generic_memset (void *, int, size_t);
+
+typedef void *(*proto_t) (void *, int, size_t);
+
+IMPL (memset, 1)
+IMPL (generic_memset, 0)
+#else
 static void
 memset_zero (void * s, size_t len)
 {
@@ -35,6 +47,7 @@ typedef void (*proto_t) (void *, size_t);
 
 IMPL (bzero, 1)
 IMPL (memset_zero, 0)
+#endif
 
 static void
 do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, size_t n)
@@ -45,7 +58,11 @@ do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, size_t n)
   TIMING_NOW (start);
   for (i = 0; i < iters; ++i)
     {
+#ifdef DO_MEMSET
+      CALL (impl, s, 0, n);
+#else
       CALL (impl, s, n);
+#endif
     }
   TIMING_NOW (stop);
 
@@ -115,3 +132,13 @@ test_main (void)
 }
 
 #include <support/test-driver.c>
+
+#ifdef DO_MEMSET
+# define libc_hidden_builtin_def(X)
+# define libc_hidden_def(X)
+# define libc_hidden_weak(X)
+# define weak_alias(X,Y)
+# undef MEMSET
+# define MEMSET generic_memset
+# include <string/memset.c>
+#endif