aboutsummaryrefslogtreecommitdiff
path: root/benchtests
diff options
context:
space:
mode:
Diffstat (limited to 'benchtests')
-rw-r--r--benchtests/bench-memcpy.c19
-rw-r--r--benchtests/bench-memmove.c30
-rw-r--r--benchtests/bench-memset-large.c36
-rw-r--r--benchtests/bench-memset-walk.c37
-rw-r--r--benchtests/bench-memset.c34
5 files changed, 65 insertions, 91 deletions
diff --git a/benchtests/bench-memcpy.c b/benchtests/bench-memcpy.c
index 6c5c549..21cb000 100644
--- a/benchtests/bench-memcpy.c
+++ b/benchtests/bench-memcpy.c
@@ -23,23 +23,16 @@
# define TEST_NAME "memcpy"
# include "bench-string.h"
-char *
-simple_memcpy (char *dst, const char *src, size_t n)
-{
- char *ret = dst;
- while (n--)
- *dst++ = *src++;
- return ret;
-}
+void *generic_memcpy (void *, const void *, size_t);
IMPL (memcpy, 1)
-IMPL (simple_memcpy, 0)
+IMPL (generic_memcpy, 0)
#endif
# include "json-lib.h"
-typedef char *(*proto_t) (char *, const char *, size_t);
+typedef void *(*proto_t) (void *, const void *, size_t);
static void
do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, const char *src,
@@ -161,3 +154,9 @@ test_main (void)
}
#include <support/test-driver.c>
+
+#define libc_hidden_builtin_def(X)
+#undef MEMCPY
+#define MEMCPY generic_memcpy
+#include <string/memcpy.c>
+#include <string/wordcopy.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 <support/test-driver.c>
+
+#define libc_hidden_builtin_def(X)
+#undef MEMMOVE
+#define MEMMOVE generic_memmove
+#include <string/memmove.c>
+#include <string/wordcopy.c>
diff --git a/benchtests/bench-memset-large.c b/benchtests/bench-memset-large.c
index d99f0a2..97ba30f 100644
--- a/benchtests/bench-memset-large.c
+++ b/benchtests/bench-memset-large.c
@@ -17,38 +17,20 @@
<http://www.gnu.org/licenses/>. */
#define TEST_MAIN
-#ifndef WIDE
-# define TEST_NAME "memset"
-#else
-# define TEST_NAME "wmemset"
-#endif /* WIDE */
+#define TEST_NAME "memset"
#define START_SIZE (128 * 1024)
#define MIN_PAGE_SIZE (getpagesize () + 64 * 1024 * 1024)
#define TIMEOUT (20 * 60)
#include "bench-string.h"
-#ifndef WIDE
-# define SIMPLE_MEMSET simple_memset
-#else
-# define SIMPLE_MEMSET simple_wmemset
-#endif /* WIDE */
-
#include <assert.h>
#include "json-lib.h"
-IMPL (MEMSET, 1)
-
-typedef CHAR *(*proto_t) (CHAR *, int, size_t);
+void *generic_memset (void *, int, size_t);
+typedef void *(*proto_t) (void *, int, size_t);
-CHAR *
-inhibit_loop_to_libcall
-SIMPLE_MEMSET (CHAR *s, int c, size_t n)
-{
- CHAR *r = s, *end = s + n;
- while (r < end)
- *r++ = c;
- return s;
-}
+IMPL (MEMSET, 1)
+IMPL (generic_memset, 0)
static void
do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s,
@@ -133,3 +115,11 @@ test_main (void)
}
#include <support/test-driver.c>
+
+#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>
diff --git a/benchtests/bench-memset-walk.c b/benchtests/bench-memset-walk.c
index 930aae3..2d18c18 100644
--- a/benchtests/bench-memset-walk.c
+++ b/benchtests/bench-memset-walk.c
@@ -17,39 +17,20 @@
<http://www.gnu.org/licenses/>. */
#define TEST_MAIN
-#ifndef WIDE
-# define TEST_NAME "memset"
-#else
-# define TEST_NAME "wmemset"
-#endif /* WIDE */
+#define TEST_NAME "memset"
#define START_SIZE 128
#define MIN_PAGE_SIZE (getpagesize () + 32 * 1024 * 1024)
#define TIMEOUT (20 * 60)
#include "bench-string.h"
-#ifndef WIDE
-# define SIMPLE_MEMSET simple_memset
-#else
-# define SIMPLE_MEMSET simple_wmemset
-#endif /* WIDE */
-
#include <assert.h>
#include "json-lib.h"
+void *generic_memset (void *, int, size_t);
+typedef void *(*proto_t) (void *, int, size_t);
-typedef CHAR *(*proto_t) (CHAR *, int, size_t);
-
-CHAR *
-inhibit_loop_to_libcall
-SIMPLE_MEMSET (CHAR *s, int c, size_t n)
-{
- CHAR *r = s, *end = s + n;
- while (r < end)
- *r++ = c;
- return s;
-}
-
-IMPL (SIMPLE_MEMSET, 1)
+IMPL (MEMSET, 1)
+IMPL (generic_memset, 0)
static void
do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, CHAR *s_end,
@@ -132,3 +113,11 @@ test_main (void)
}
#include <support/test-driver.c>
+
+#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>
diff --git a/benchtests/bench-memset.c b/benchtests/bench-memset.c
index 0df55d1..69e8d36 100644
--- a/benchtests/bench-memset.c
+++ b/benchtests/bench-memset.c
@@ -21,28 +21,23 @@
# define TEST_NAME "memset"
#else
# define TEST_NAME "wmemset"
+# define generic_memset generic_wmemset
#endif /* WIDE */
#define MIN_PAGE_SIZE 131072
#include "bench-string.h"
#include "json-lib.h"
-CHAR *SIMPLE_MEMSET (CHAR *, int, size_t);
+#ifdef WIDE
+CHAR *generic_wmemset (CHAR *, CHAR, size_t);
+#else
+void *generic_memset (void *, int, size_t);
+#endif
-typedef CHAR *(*proto_t) (CHAR *, int, size_t);
+typedef void *(*proto_t) (void *, int, size_t);
IMPL (MEMSET, 1)
-IMPL (SIMPLE_MEMSET, 0)
-
-CHAR *
-inhibit_loop_to_libcall
-SIMPLE_MEMSET (CHAR *s, int c, size_t n)
-{
- CHAR *r = s, *end = s + n;
- while (r < end)
- *r++ = c;
- return s;
-}
+IMPL (generic_memset, 0)
static void
do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s,
@@ -146,3 +141,16 @@ test_main (void)
}
#include <support/test-driver.c>
+
+#define libc_hidden_builtin_def(X)
+#define libc_hidden_def(X)
+#define libc_hidden_weak(X)
+#define weak_alias(X,Y)
+#ifndef WIDE
+# undef MEMSET
+# define MEMSET generic_memset
+# include <string/memset.c>
+#else
+# define WMEMSET generic_wmemset
+# include <wcsmbs/wmemset.c>
+#endif