+2018-12-21 Wilco Dijkstra <wdijkstr@arm.com>
+
+ * benchtests/bench-memchr.c: Cleanup defines.
+ * benchtests/bench-memcmp.c: Likewise.
+ * benchtests/bench-memset.c: Likewise.
+ * benchtests/bench-memset-large.c: Likewise.
+ * benchtests/bench-memset-walk.c: Likewise.
+ * benchtests/bench-stpcpy.c: Likewise.
+ * benchtests/bench-stpncpy.c: Likewise.
+ * benchtests/bench-strcat.c: Likewise.
+ * benchtests/bench-strchr.c: Likewise.
+ * benchtests/bench-strcmp.c: Likewise.
+ * benchtests/bench-strcpy.c: Likewise.
+ * benchtests/bench-strcspn.c: Likewise.
+ * benchtests/bench-string.h: Likewise.
+ * benchtests/bench-strlen.c: Likewise.
+ * benchtests/bench-strncat.c: Likewise.
+ * benchtests/bench-strncmp.c: Likewise.
+ * benchtests/bench-strncpy.c: Likewise.
+ * benchtests/bench-strnlen.c: Likewise.
+ * benchtests/bench-strpbrk.c: Likewise.
+ * benchtests/bench-strrchr.c: Likewise.
+ * benchtests/bench-strspn.c: Likewise.
+
2018-12-21 Joseph Myers <joseph@codesourcery.com>
* stdlib/longlong.h: Update from GCC.
<http://www.gnu.org/licenses/>. */
#ifndef WIDE
-# define CHAR char
# define SMALL_CHAR 127
#else
-# include <wchar.h>
-# define CHAR wchar_t
# define SMALL_CHAR 1273
#endif /* WIDE */
# include "bench-string.h"
# ifndef WIDE
-# define MEMCHR memchr
# define SIMPLE_MEMCHR simple_memchr
# else
-# define MEMCHR wmemchr
# define SIMPLE_MEMCHR simple_wmemchr
# endif /* WIDE */
#endif
#include "bench-string.h"
#ifdef WIDE
-# include <inttypes.h>
-# include <wchar.h>
-# define MEMCMP wmemcmp
-# define MEMCPY wmemcpy
# define SIMPLE_MEMCMP simple_wmemcmp
-# define CHAR wchar_t
-# define UCHAR wchar_t
-# define CHARBYTES 4
-# define CHAR__MIN WCHAR_MIN
-# define CHAR__MAX WCHAR_MAX
int
simple_wmemcmp (const wchar_t *s1, const wchar_t *s2, size_t n)
{
#else
# include <limits.h>
-# define MEMCMP memcmp
-# define MEMCPY memcpy
# define SIMPLE_MEMCMP simple_memcmp
-# define CHAR char
-# define MAX_CHAR 255
-# define UCHAR unsigned char
-# define CHARBYTES 1
-# define CHAR__MIN CHAR_MIN
-# define CHAR__MAX CHAR_MAX
int
simple_memcmp (const char *s1, const char *s2, size_t n)
s2 = (CHAR *) (buf2 + align2);
for (i = 0; i < len; i++)
- s1[i] = s2[i] = 1 + (23 << ((CHARBYTES - 1) * 8)) * i % CHAR__MAX;
+ s1[i] = s2[i] = 1 + (23 << ((CHARBYTES - 1) * 8)) * i % MAX_CHAR;
s1[len] = align1;
s2[len] = align2;
#include "bench-string.h"
#ifndef WIDE
-# define MEMSET memset
-# define CHAR char
# define SIMPLE_MEMSET simple_memset
-# define MEMCMP memcmp
#else
-# include <wchar.h>
-# define MEMSET wmemset
-# define CHAR wchar_t
# define SIMPLE_MEMSET simple_wmemset
-# define MEMCMP wmemcmp
#endif /* WIDE */
#include <assert.h>
#include "bench-string.h"
#ifndef WIDE
-# define MEMSET memset
-# define CHAR char
# define SIMPLE_MEMSET simple_memset
-# define MEMCMP memcmp
#else
-# include <wchar.h>
-# define MEMSET wmemset
-# define CHAR wchar_t
# define SIMPLE_MEMSET simple_wmemset
-# define MEMCMP wmemcmp
#endif /* WIDE */
#include <assert.h>
#include "bench-string.h"
#ifndef WIDE
-# define MEMSET memset
-# define CHAR char
# define SIMPLE_MEMSET simple_memset
-# define MEMCMP memcmp
#else
-# include <wchar.h>
-# define MEMSET wmemset
-# define CHAR wchar_t
# define SIMPLE_MEMSET simple_wmemset
-# define MEMCMP wmemcmp
#endif /* WIDE */
#include "json-lib.h"
#endif /* WIDE */
#include "bench-string.h"
#ifndef WIDE
-# define CHAR char
# define SIMPLE_STPCPY simple_stpcpy
-# define STPCPY stpcpy
#else
-# include <wchar.h>
-# define CHAR wchar_t
# define SIMPLE_STPCPY simple_wcpcpy
-# define STPCPY wcpcpy
#endif /* WIDE */
CHAR *SIMPLE_STPCPY (CHAR *, const CHAR *);
return dst - 1;
}
-#undef CHAR
#include "bench-strcpy.c"
#endif /* WIDE */
#include "bench-string.h"
#ifndef WIDE
-# define CHAR char
# define SIMPLE_STPNCPY simple_stpncpy
# define STUPID_STPNCPY stupid_stpncpy
-# define STPNCPY stpncpy
-# define STRNLEN strnlen
#else
-# include <wchar.h>
-# define CHAR wchar_t
# define SIMPLE_STPNCPY simple_wcpncpy
# define STUPID_STPNCPY stupid_wcpncpy
-# define STPNCPY wcpncpy
-# define STRNLEN wcsnlen
#endif /* WIDE */
CHAR *SIMPLE_STPNCPY (CHAR *, const CHAR *, size_t);
return dst + nc;
}
-#undef CHAR
#include "bench-strncpy.c"
#endif /* WIDE */
#include "bench-string.h"
+#define BIG_CHAR MAX_CHAR
+
#ifndef WIDE
-# define STRCAT strcat
-# define CHAR char
# define sfmt "s"
# define SIMPLE_STRCAT simple_strcat
-# define STRLEN strlen
-# define STRCMP strcmp
-# define BIG_CHAR CHAR_MAX
# define SMALL_CHAR 127
#else
-# include <wchar.h>
-# define STRCAT wcscat
-# define CHAR wchar_t
# define sfmt "ls"
# define SIMPLE_STRCAT simple_wcscat
-# define STRLEN wcslen
-# define STRCMP wcscmp
-# define BIG_CHAR WCHAR_MAX
# define SMALL_CHAR 1273
#endif /* WIDE */
#endif /* WIDE */
#include "bench-string.h"
+#define BIG_CHAR MAX_CHAR
+
#ifndef WIDE
# ifdef USE_FOR_STRCHRNUL
+# undef STRCHR
# define STRCHR strchrnul
# define stupid_STRCHR stupid_STRCHRNUL
# define simple_STRCHR simple_STRCHRNUL
-# else
-# define STRCHR strchr
# endif /* !USE_FOR_STRCHRNUL */
-# define STRLEN strlen
-# define CHAR char
-# define BIG_CHAR CHAR_MAX
# define MIDDLE_CHAR 127
# define SMALL_CHAR 23
-# define UCHAR unsigned char
#else
-# include <wchar.h>
# ifdef USE_FOR_STRCHRNUL
+# undef STRCHR
# define STRCHR wcschrnul
# define stupid_STRCHR stupid_WCSCHRNUL
# define simple_STRCHR simple_WCSCHRNUL
-# else
-# define STRCHR wcschr
# endif /* !USE_FOR_STRCHRNUL */
-# define STRLEN wcslen
-# define CHAR wchar_t
-# define BIG_CHAR WCHAR_MAX
# define MIDDLE_CHAR 1121
# define SMALL_CHAR 851
-# define UCHAR wchar_t
#endif /* WIDE */
#ifdef USE_FOR_STRCHRNUL
#include "bench-string.h"
#ifdef WIDE
-# include <wchar.h>
-
# define L(str) L##str
-# define STRCMP wcscmp
-# define STRCPY wcscpy
-# define STRLEN wcslen
-# define MEMCPY wmemcpy
# define SIMPLE_STRCMP simple_wcscmp
# define STUPID_STRCMP stupid_wcscmp
-# define CHAR wchar_t
-# define UCHAR wchar_t
-# define CHARBYTES 4
# define CHARBYTESLOG 2
-# define CHARALIGN __alignof__ (CHAR)
# define MIDCHAR 0x7fffffff
# define LARGECHAR 0xfffffffe
-# define CHAR__MAX WCHAR_MAX
-# define CHAR__MIN WCHAR_MIN
/* Wcscmp uses signed semantics for comparison, not unsigned */
/* Avoid using substraction since possible overflow */
# include <limits.h>
# define L(str) str
-# define STRCMP strcmp
-# define STRCPY strcpy
-# define STRLEN strlen
-# define MEMCPY memcpy
# define SIMPLE_STRCMP simple_strcmp
# define STUPID_STRCMP stupid_strcmp
-# define CHAR char
-# define UCHAR unsigned char
-# define CHARBYTES 1
# define CHARBYTESLOG 0
-# define CHARALIGN 1
# define MIDCHAR 0x7f
# define LARGECHAR 0xfe
-# define CHAR__MAX CHAR_MAX
-# define CHAR__MIN CHAR_MIN
/* Strcmp uses unsigned semantics for comparison. */
int
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#define BIG_CHAR MAX_CHAR
+
#ifdef WIDE
-# include <wchar.h>
-# define CHAR wchar_t
-# define UCHAR wchar_t
# define sfmt "ls"
-# define BIG_CHAR WCHAR_MAX
# define SMALL_CHAR 1273
-# define STRCMP wcscmp
-# define MEMCMP wmemcmp
-# define MEMSET wmemset
#else
-# define CHAR char
-# define UCHAR unsigned char
# define sfmt "s"
-# define BIG_CHAR CHAR_MAX
# define SMALL_CHAR 127
-# define STRCMP strcmp
-# define MEMCMP memcmp
-# define MEMSET memset
#endif
#ifndef STRCPY_RESULT
# include "bench-string.h"
# ifndef WIDE
# define SIMPLE_STRCPY simple_strcpy
-# define STRCPY strcpy
# else
# define SIMPLE_STRCPY simple_wcscpy
-# define STRCPY wcscpy
# endif
CHAR *SIMPLE_STRCPY (CHAR *, const CHAR *);
#include "bench-string.h"
#ifndef WIDE
-# define STRCSPN strcspn
-# define CHAR char
# define SIMPLE_STRCSPN simple_strcspn
# define STUPID_STRCSPN stupid_strcspn
-# define STRLEN strlen
#else
-# include <wchar.h>
-# define STRCSPN wcscspn
-# define CHAR wchar_t
# define SIMPLE_STRCSPN simple_wcscspn
# define STUPID_STRCSPN stupid_wcscspn
-# define STRLEN wcslen
#endif /* WIDE */
typedef size_t (*proto_t) (const CHAR *, const CHAR *);
return i;
}
-#undef CHAR
-#undef STRLEN
#include "bench-strpbrk.c"
# define GLRO(x) _##x
# include "bench-timing.h"
+# ifndef WIDE
+# define CHAR char
+# define UCHAR unsigned char
+# define CHARBYTES 1
+# define MAX_CHAR CHAR_MAX
+# define MEMCHR memchr
+# define MEMCMP memcmp
+# define MEMCPY memcpy
+# define MEMSET memset
+# define STRCAT strcat
+# define STRLEN strlen
+# define STRCMP strcmp
+# define STRCHR strchr
+# define STRCPY strcpy
+# define STRNLEN strnlen
+# define STRCSPN strcspn
+# define STRNCAT strncat
+# define STRNCMP strncmp
+# define STRNCPY strncpy
+# define STRPBRK strpbrk
+# define STRRCHR strrchr
+# define STRSPN strspn
+# define STPCPY stpcpy
+# define STPNCPY stpncpy
+# else
+# include <wchar.h>
+# define CHAR wchar_t
+# define UCHAR wchar_t
+# define CHARBYTES 4
+# define MAX_CHAR WCHAR_MAX
+# define MEMCHR wmemchr
+# define MEMCMP wmemcmp
+# define MEMCPY wmemcpy
+# define MEMSET wmemset
+# define STRCAT wcscat
+# define STRLEN wcslen
+# define STRCMP wcscmp
+# define STRCHR wcschr
+# define STRCPY wcscpy
+# define STRNLEN wcsnlen
+# define STRCSPN wcscspn
+# define STRNCAT wcsncat
+# define STRNCMP wcsncmp
+# define STRNCPY wcsncpy
+# define STRPBRK wcspbrk
+# define STRRCHR wcsrchr
+# define STRSPN wcsspn
+# define STPCPY wcpcpy
+# define STPNCPY wcpncpy
+# endif /* WIDE */
# define TEST_FUNCTION test_main
# ifndef TIMEOUT
#include "bench-string.h"
#ifndef WIDE
-# define STRLEN strlen
-# define CHAR char
# define MAX_CHAR CHAR_MAX
#else
-# include <wchar.h>
-# define STRLEN wcslen
-# define CHAR wchar_t
# define MAX_CHAR WCHAR_MAX
#endif
#endif /* WIDE */
#include "bench-string.h"
+#define BIG_CHAR MAX_CHAR
+
#ifndef WIDE
-# define STRNCAT strncat
-# define CHAR char
# define SIMPLE_STRNCAT simple_strncat
# define STUPID_STRNCAT stupid_strncat
-# define STRLEN strlen
-# define MEMCMP memcmp
-# define BIG_CHAR CHAR_MAX
# define SMALL_CHAR 127
#else
-# include <wchar.h>
-# define STRNCAT wcsncat
-# define CHAR wchar_t
# define SIMPLE_STRNCAT simple_wcsncat
# define STUPID_STRNCAT stupid_wcsncat
-# define STRLEN wcslen
-# define MEMCMP wmemcmp
-# define BIG_CHAR WCHAR_MAX
# define SMALL_CHAR 1273
#endif /* WIDE */
#include "json-lib.h"
#ifdef WIDE
-# include <wchar.h>
-
# define L(str) L##str
-# define STRNCMP wcsncmp
# define SIMPLE_STRNCMP simple_wcsncmp
# define STUPID_STRNCMP stupid_wcsncmp
-# define CHAR wchar_t
-# define CHARBYTES 4
/* Wcsncmp uses signed semantics for comparison, not unsigned.
Avoid using substraction since possible overflow. */
#else
# define L(str) str
-# define STRNCMP strncmp
# define SIMPLE_STRNCMP simple_strncmp
# define STUPID_STRNCMP stupid_strncmp
-# define CHAR char
-# define CHARBYTES 1
/* Strncmp uses unsigned semantics for comparison. */
int
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#define BIG_CHAR MAX_CHAR
+
#ifdef WIDE
-# include <wchar.h>
-# define CHAR wchar_t
-# define UCHAR wchar_t
-# define BIG_CHAR WCHAR_MAX
# define SMALL_CHAR 1273
-# define MEMCMP wmemcmp
-# define MEMSET wmemset
-# define STRNLEN wcsnlen
#else
-# define CHAR char
-# define UCHAR unsigned char
-# define BIG_CHAR CHAR_MAX
# define SMALL_CHAR 127
-# define MEMCMP memcmp
-# define MEMSET memset
-# define STRNLEN strnlen
#endif /* !WIDE */
-
#ifndef STRNCPY_RESULT
# define STRNCPY_RESULT(dst, len, n) dst
# define TEST_MAIN
# ifndef WIDE
# define SIMPLE_STRNCPY simple_strncpy
# define STUPID_STRNCPY stupid_strncpy
-# define STRNCPY strncpy
# else
# define SIMPLE_STRNCPY simple_wcsncpy
# define STUPID_STRNCPY stupid_wcsncpy
-# define STRNCPY wcsncpy
# endif /* WIDE */
CHAR *SIMPLE_STRNCPY (CHAR *, const CHAR *, size_t);
#endif /* WIDE */
#include "bench-string.h"
+#define BIG_CHAR MAX_CHAR
+
#ifndef WIDE
-# define STRNLEN strnlen
-# define CHAR char
-# define BIG_CHAR CHAR_MAX
# define MIDDLE_CHAR 127
# define SIMPLE_STRNLEN simple_strnlen
#else
-# include <wchar.h>
-# define STRNLEN wcsnlen
-# define CHAR wchar_t
-# define BIG_CHAR WCHAR_MAX
# define MIDDLE_CHAR 1121
# define SIMPLE_STRNLEN simple_wcsnlen
#endif /* WIDE */
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#define BIG_CHAR MAX_CHAR
+
#ifndef WIDE
-# define CHAR char
-# define STRLEN strlen
-# define STRCHR strchr
-# define BIG_CHAR CHAR_MAX
# define SMALL_CHAR 127
#else
-# include <wchar.h>
-# define CHAR wchar_t
-# define STRLEN wcslen
-# define STRCHR wcschr
-# define BIG_CHAR WCHAR_MAX
# define SMALL_CHAR 1273
#endif /* WIDE */
# include "bench-string.h"
# ifndef WIDE
-# define STRPBRK strpbrk
# define SIMPLE_STRPBRK simple_strpbrk
# define STUPID_STRPBRK stupid_strpbrk
# else
-# include <wchar.h>
-# define STRPBRK wcspbrk
# define SIMPLE_STRPBRK simple_wcspbrk
# define STUPID_STRPBRK stupid_wcspbrk
# endif /* WIDE */
#endif
#include "bench-string.h"
+#define BIG_CHAR MAX_CHAR
+
#ifdef WIDE
-# include <wchar.h>
# define SIMPLE_STRRCHR simple_wcsrchr
-# define STRRCHR wcsrchr
-# define CHAR wchar_t
-# define UCHAR wchar_t
-# define BIG_CHAR WCHAR_MAX
# define SMALL_CHAR 1273
#else
# define SIMPLE_STRRCHR simple_strrchr
-# define STRRCHR strrchr
-# define CHAR char
-# define UCHAR unsigned char
-# define BIG_CHAR CHAR_MAX
# define SMALL_CHAR 127
#endif
#endif /* WIDE */
#include "bench-string.h"
+#define BIG_CHAR MAX_CHAR
+
#ifndef WIDE
-# define STRSPN strspn
-# define CHAR char
# define SIMPLE_STRSPN simple_strspn
# define STUPID_STRSPN stupid_strspn
-# define STRLEN strlen
-# define STRCHR strchr
-# define BIG_CHAR CHAR_MAX
# define SMALL_CHAR 127
#else
-# include <wchar.h>
-# define STRSPN wcsspn
-# define CHAR wchar_t
# define SIMPLE_STRSPN simple_wcsspn
# define STUPID_STRSPN stupid_wcsspn
-# define STRLEN wcslen
-# define STRCHR wcschr
-# define BIG_CHAR WCHAR_MAX
# define SMALL_CHAR 1273
#endif /* WIDE */