1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

tests/string: Drop simple/stupid/builtin tests

In most cases the simple/stupid/builtin functions were in there to
benchmark optimized implementations against.  Only in some cases the
functions are used to check expected results.

Remove these tests from IMPL() and only keep them in wherever they're
used for a specific purpose, e.g. to generate expected results.

This improves timing of `make subdirs=string` by over a minute and a
half (over 15%) on a Whiskey Lake laptop.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Noah Goldstein <libc-alpha@sourceware.org>
This commit is contained in:
Siddhesh Poyarekar
2022-04-06 20:53:24 +05:30
parent dfc7bf8a24
commit 67e3b0c63c
25 changed files with 43 additions and 230 deletions

View File

@ -35,7 +35,6 @@
#ifndef WIDE
# ifdef USE_FOR_STRCHRNUL
# define STRCHR strchrnul
# define stupid_STRCHR stupid_STRCHRNUL
# define simple_STRCHR simple_STRCHRNUL
# else
# define STRCHR strchr
@ -51,7 +50,6 @@
# include <wchar.h>
# ifdef USE_FOR_STRCHRNUL
# define STRCHR wcschrnul
# define stupid_STRCHR stupid_WCSCHRNUL
# define simple_STRCHR simple_WCSCHRNUL
# else
# define STRCHR wcschr
@ -74,17 +72,9 @@
typedef CHAR *(*proto_t) (const CHAR *, int);
/* Naive implementation to verify results. */
CHAR *
simple_STRCHR (const CHAR *s, int c)
{
for (; *s != (CHAR) c; ++s)
if (*s == '\0')
return NULLRET ((CHAR *) s);
return (CHAR *) s;
}
CHAR *
stupid_STRCHR (const CHAR *s, int c)
{
size_t n = STRLEN (s) + 1;
@ -94,8 +84,6 @@ stupid_STRCHR (const CHAR *s, int c)
return NULLRET ((CHAR *) s - 1);
}
IMPL (stupid_STRCHR, 0)
IMPL (simple_STRCHR, 0)
IMPL (STRCHR, 1)
static int
@ -231,7 +219,7 @@ check1 (void)
{
CHAR s[] __attribute__((aligned(16))) = L ("\xff");
CHAR c = L ('\xfe');
CHAR *exp_result = stupid_STRCHR (s, c);
CHAR *exp_result = simple_STRCHR (s, c);
FOR_EACH_IMPL (impl, 0)
check_result (impl, s, c, exp_result);