From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by sourceware.org (Postfix) with ESMTPS id 67E503858C27 for ; Wed, 27 Oct 2021 17:59:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 67E503858C27 Received: by mail-pj1-x1035.google.com with SMTP id om14so2636130pjb.5 for ; Wed, 27 Oct 2021 10:59:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ptg+OcStQ+vWeA3yfIUqfMw4c4Bs4q/U0KfQPIlJZuo=; b=aJ/yu5DD4ef6OF8cb0ydlmW49eDyRfxPl/jW/lHjp1u4WngiviOiQpk6KaAuijwzY3 mt9DqRNjALwxl+/6AY20cCtCPthB65qhkiNbZs1Lyx/n4qFxeehMARgsSK3xrUq8kmgJ 44CJYJoqBwhg2Z26vlp+0cfmxwxuQupqzD6Bn5FDxouAkErV0nOk8C9f4WhxkaGrHDH6 SqlmbMemAoruV/DO2KGb8ZQxWxBEtoltvi01uB0KwrN1l4OU9UUYT22UU736yO8JlUyv n2q0r90ojoEUHBuLyejEGa+SFuIgH3V/CLy9HojONJH4IjfHSI9ndzlqRITsOsOsbaSQ tnyQ== X-Gm-Message-State: AOAM530WyDj1DlUPEdhSj39pITPcFgucDmSM8sJd3LoHLtxqsXxyKGPw QtDEC6AMipVo14NxP71hqABFG2bV90MG49cOl905w4oiaHc= X-Google-Smtp-Source: ABdhPJzPHCCNlJynNkdMrxg5XnkIdlTpTRzhsGBuT+XmKmtpZWTNmQjjldT8Czo0As2MwLMy/Tfces7usD0morPfuCQ= X-Received: by 2002:a17:90b:3b86:: with SMTP id pc6mr7280830pjb.143.1635357589490; Wed, 27 Oct 2021 10:59:49 -0700 (PDT) MIME-Version: 1.0 References: <20211027024323.1199441-2-goldstein.w.n@gmail.com> <20211027160737.1987445-1-goldstein.w.n@gmail.com> In-Reply-To: <20211027160737.1987445-1-goldstein.w.n@gmail.com> From: "H.J. Lu" Date: Wed, 27 Oct 2021 10:59:13 -0700 Message-ID: Subject: Re: [PATCH v2 2/6] Benchtests: Add benchtests for __memcmpeq To: Noah Goldstein Cc: GNU C Library Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3029.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2021 17:59:52 -0000 On Wed, Oct 27, 2021 at 9:08 AM Noah Goldstein via Libc-alpha 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 | 14 ++++++++------ > benchtests/bench-memcmpeq.c | 20 ++++++++++++++++++++ > 3 files changed, 29 insertions(+), 7 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..2cf65525bb 100644 > --- a/benchtests/bench-memcmp.c > +++ b/benchtests/bench-memcmp.c > @@ -17,17 +17,21 @@ > . */ > > #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 SIMPLE_MEMCMP simple_wmemcmp > #else > # define TEST_NAME "memcmp" > +# define SIMPLE_MEMCMP simple_memcmp > #endif > #include "bench-string.h" > #ifdef WIDE > > -# define SIMPLE_MEMCMP simple_wmemcmp > 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; > /* Warning! > @@ -40,10 +44,8 @@ simple_wmemcmp (const wchar_t *s1, const wchar_t *s2, size_t n) > #else > # include > > -# define SIMPLE_MEMCMP simple_memcmp > - > 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; > > 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 > + . */ > + > +#define TEST_MEMCMPEQ 1 > +#include "bench-memcmp.c" > -- > 2.25.1 > LGTM. Reviewed-by: H.J. Lu Thanks. -- H.J.