mirror of git://sourceware.org/git/glibc.git
Benchtests: Add benchtests for __memcmpeq
No bug. This commit adds __memcmpeq benchmarks. The benchmarks just use the existing ones in memcmp. This will be useful for testing implementations of __memcmpeq that do not just alias memcmp.
This commit is contained in:
parent
3592ccd472
commit
cf3acd774f
|
@ -103,7 +103,7 @@ bench := $(foreach B,$(filter bench-%,${BENCHSET}), ${${B}})
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# String function benchmarks.
|
# String function benchmarks.
|
||||||
string-benchset := memccpy memchr memcmp memcpy memmem memmove \
|
string-benchset := memccpy memchr memcmp memcmpeq memcpy memmem memmove \
|
||||||
mempcpy memset rawmemchr stpcpy stpncpy strcasecmp strcasestr \
|
mempcpy memset rawmemchr stpcpy stpncpy strcasecmp strcasestr \
|
||||||
strcat strchr strchrnul strcmp strcpy strcspn strlen \
|
strcat strchr strchrnul strcmp strcpy strcspn strlen \
|
||||||
strncasecmp strncat strncmp strncpy strnlen strpbrk strrchr \
|
strncasecmp strncat strncmp strncpy strnlen strpbrk strrchr \
|
||||||
|
|
|
@ -17,17 +17,21 @@
|
||||||
<https://www.gnu.org/licenses/>. */
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#define TEST_MAIN
|
#define TEST_MAIN
|
||||||
#ifdef WIDE
|
#ifdef TEST_MEMCMPEQ
|
||||||
|
# define TEST_NAME "__memcmpeq"
|
||||||
|
# define SIMPLE_MEMCMP simple_memcmpeq
|
||||||
|
#elif defined WIDE
|
||||||
# define TEST_NAME "wmemcmp"
|
# define TEST_NAME "wmemcmp"
|
||||||
|
# define SIMPLE_MEMCMP simple_wmemcmp
|
||||||
#else
|
#else
|
||||||
# define TEST_NAME "memcmp"
|
# define TEST_NAME "memcmp"
|
||||||
|
# define SIMPLE_MEMCMP simple_memcmp
|
||||||
#endif
|
#endif
|
||||||
#include "bench-string.h"
|
#include "bench-string.h"
|
||||||
#ifdef WIDE
|
#ifdef WIDE
|
||||||
|
|
||||||
# define SIMPLE_MEMCMP simple_wmemcmp
|
|
||||||
int
|
int
|
||||||
simple_wmemcmp (const wchar_t *s1, const wchar_t *s2, size_t n)
|
SIMPLE_MEMCMP (const wchar_t *s1, const wchar_t *s2, size_t n)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
/* Warning!
|
/* Warning!
|
||||||
|
@ -40,10 +44,8 @@ simple_wmemcmp (const wchar_t *s1, const wchar_t *s2, size_t n)
|
||||||
#else
|
#else
|
||||||
# include <limits.h>
|
# include <limits.h>
|
||||||
|
|
||||||
# define SIMPLE_MEMCMP simple_memcmp
|
|
||||||
|
|
||||||
int
|
int
|
||||||
simple_memcmp (const char *s1, const char *s2, size_t n)
|
SIMPLE_MEMCMP (const char *s1, const char *s2, size_t n)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
/* Measure __memcmpeq functions.
|
||||||
|
Copyright (C) 2015-2021 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with the GNU C Library; if not, see
|
||||||
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#define TEST_MEMCMPEQ 1
|
||||||
|
#include "bench-memcmp.c"
|
Loading…
Reference in New Issue