From 3c05dd79d04da765b1ec93ea97474b3b8d9e0af3 Mon Sep 17 00:00:00 2001 From: Wilco Dijkstra Date: Thu, 29 Aug 2019 15:45:49 +0100 Subject: Use generic memset/memcpy/memmove in benchtests Use the generic C memset/memcpy/memmove in benchtests since comparing against a slow byte-oriented implementation makes no sense. Reviewed-by: Adhemerval Zanella 2019-08-29 Wilco Dijkstra * benchtests/bench-memcpy.c (simple_memcpy): Remove. (generic_memcpy): Include generic C memcpy. * benchtests/bench-memmove.c (simple_memmove): Remove. (generic_memmove): Include generic C memmove. * benchtests/bench-memset.c (simple_memset): Remove. (generic_memset): Include generic C memset. * benchtests/bench-memset-large.c (simple_memset): Remove. (generic_memset): Include generic C memset. * benchtests/bench-memset-walk.c (simple_memset): Remove. (generic_memset): Include generic C memset. * string/memcpy.c (MEMCPY): Add defines to enable redirection. * string/memset.c (MEMSET): Likewise. * sysdeps/x86_64/memcopy.h: Remove empty file. --- benchtests/bench-memmove.c | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) (limited to 'benchtests/bench-memmove.c') diff --git a/benchtests/bench-memmove.c b/benchtests/bench-memmove.c index a4d5ecd..9804e71 100644 --- a/benchtests/bench-memmove.c +++ b/benchtests/bench-memmove.c @@ -21,30 +21,12 @@ #include "bench-string.h" #include "json-lib.h" -char *simple_memmove (char *, const char *, size_t); +void *generic_memmove (void *, const void *, size_t); -typedef char *(*proto_t) (char *, const char *, size_t); +typedef void *(*proto_t) (void *, const void *, size_t); IMPL (memmove, 1) -IMPL (simple_memmove, 0) - -char * -inhibit_loop_to_libcall -simple_memmove (char *dst, const char *src, size_t n) -{ - char *ret = dst; - if (src < dst) - { - dst += n; - src += n; - while (n--) - *--dst = *--src; - } - else - while (n--) - *dst++ = *src++; - return ret; -} +IMPL (generic_memmove, 0) static void do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, char *src, @@ -165,3 +147,9 @@ test_main (void) } #include + +#define libc_hidden_builtin_def(X) +#undef MEMMOVE +#define MEMMOVE generic_memmove +#include +#include -- cgit v1.1