[v1,2/6] Benchtests: Add benchtests for __memcmpeq
Checks
Context |
Check |
Description |
dj/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
Commit Message
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.
---
benchtests/Makefile | 2 +-
benchtests/bench-memcmp.c | 4 +++-
benchtests/bench-memcmpeq.c | 20 ++++++++++++++++++++
3 files changed, 24 insertions(+), 2 deletions(-)
create mode 100644 benchtests/bench-memcmpeq.c
Comments
On Tue, Oct 26, 2021 at 7:43 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>
> 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.
> ---
> benchtests/Makefile | 2 +-
> benchtests/bench-memcmp.c | 4 +++-
> benchtests/bench-memcmpeq.c | 20 ++++++++++++++++++++
> 3 files changed, 24 insertions(+), 2 deletions(-)
> create mode 100644 benchtests/bench-memcmpeq.c
>
> diff --git a/benchtests/Makefile b/benchtests/Makefile
> index b690aaf65b..7be0e47c47 100644
> --- a/benchtests/Makefile
> +++ b/benchtests/Makefile
> @@ -103,7 +103,7 @@ bench := $(foreach B,$(filter bench-%,${BENCHSET}), ${${B}})
> endif
>
> # 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 \
> strcat strchr strchrnul strcmp strcpy strcspn strlen \
> strncasecmp strncat strncmp strncpy strnlen strpbrk strrchr \
> diff --git a/benchtests/bench-memcmp.c b/benchtests/bench-memcmp.c
> index 0d6a93bf29..546b06e1ab 100644
> --- a/benchtests/bench-memcmp.c
> +++ b/benchtests/bench-memcmp.c
> @@ -17,7 +17,9 @@
> <https://www.gnu.org/licenses/>. */
>
> #define TEST_MAIN
> -#ifdef WIDE
> +#ifdef TEST_MEMCMPEQ
> +# define TEST_NAME "__memcmpeq"
> +#elif defined WIDE
> # define TEST_NAME "wmemcmp"
> #else
> # define TEST_NAME "memcmp"
Please rename simple_memcmp to simple_memcmpeq.
> diff --git a/benchtests/bench-memcmpeq.c b/benchtests/bench-memcmpeq.c
> new file mode 100644
> index 0000000000..e918d4f77c
> --- /dev/null
> +++ b/benchtests/bench-memcmpeq.c
> @@ -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"
> --
> 2.25.1
>
On Wed, Oct 27, 2021 at 7:46 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Tue, Oct 26, 2021 at 7:43 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
> >
> > 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.
> > ---
> > benchtests/Makefile | 2 +-
> > benchtests/bench-memcmp.c | 4 +++-
> > benchtests/bench-memcmpeq.c | 20 ++++++++++++++++++++
> > 3 files changed, 24 insertions(+), 2 deletions(-)
> > create mode 100644 benchtests/bench-memcmpeq.c
> >
> > diff --git a/benchtests/Makefile b/benchtests/Makefile
> > index b690aaf65b..7be0e47c47 100644
> > --- a/benchtests/Makefile
> > +++ b/benchtests/Makefile
> > @@ -103,7 +103,7 @@ bench := $(foreach B,$(filter bench-%,${BENCHSET}), ${${B}})
> > endif
> >
> > # 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 \
> > strcat strchr strchrnul strcmp strcpy strcspn strlen \
> > strncasecmp strncat strncmp strncpy strnlen strpbrk strrchr \
> > diff --git a/benchtests/bench-memcmp.c b/benchtests/bench-memcmp.c
> > index 0d6a93bf29..546b06e1ab 100644
> > --- a/benchtests/bench-memcmp.c
> > +++ b/benchtests/bench-memcmp.c
> > @@ -17,7 +17,9 @@
> > <https://www.gnu.org/licenses/>. */
> >
> > #define TEST_MAIN
> > -#ifdef WIDE
> > +#ifdef TEST_MEMCMPEQ
> > +# define TEST_NAME "__memcmpeq"
> > +#elif defined WIDE
> > # define TEST_NAME "wmemcmp"
> > #else
> > # define TEST_NAME "memcmp"
>
> Please rename simple_memcmp to simple_memcmpeq.
Fixed.
>
> > diff --git a/benchtests/bench-memcmpeq.c b/benchtests/bench-memcmpeq.c
> > new file mode 100644
> > index 0000000000..e918d4f77c
> > --- /dev/null
> > +++ b/benchtests/bench-memcmpeq.c
> > @@ -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"
> > --
> > 2.25.1
> >
>
>
> --
> H.J.
@@ -103,7 +103,7 @@ bench := $(foreach B,$(filter bench-%,${BENCHSET}), ${${B}})
endif
# 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 \
strcat strchr strchrnul strcmp strcpy strcspn strlen \
strncasecmp strncat strncmp strncpy strnlen strpbrk strrchr \
@@ -17,7 +17,9 @@
<https://www.gnu.org/licenses/>. */
#define TEST_MAIN
-#ifdef WIDE
+#ifdef TEST_MEMCMPEQ
+# define TEST_NAME "__memcmpeq"
+#elif defined WIDE
# define TEST_NAME "wmemcmp"
#else
# define TEST_NAME "memcmp"
new file mode 100644
@@ -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"