From patchwork Wed Oct 27 16:07:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noah Goldstein X-Patchwork-Id: 46705 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0673E3857800 for ; Wed, 27 Oct 2021 16:08:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0673E3857800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1635350893; bh=VIp85XyxCq+ISKYV6yGjLeqAk6D3AEdslba7Va4plXM=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=loYX1A11rUqnfD5UeSJSRl76lpR5zgq0DNKkFdAt2g22da3W64GsgSR2WJq4s08Od zkku9IaD2WF4WfL1uIRLXXws03p7CxuzdJjNlSJmmYeVQJtLHpv6hzG2xRR7w1je6O z7gosoHQdI/MfF9xiVtm2/KxNQ60Y4Hn+RcTUSI4= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) by sourceware.org (Postfix) with ESMTPS id 7AED23857800 for ; Wed, 27 Oct 2021 16:07:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7AED23857800 Received: by mail-il1-x134.google.com with SMTP id 3so3490075ilq.7 for ; Wed, 27 Oct 2021 09:07:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VIp85XyxCq+ISKYV6yGjLeqAk6D3AEdslba7Va4plXM=; b=hUlPT+3NBI7qPi8uA9/ccjNFCThWYl1tyFWdfH3ZVnhLEjD9LzJADp8NpeGaIeSfDq E/mbyYIsbVnT01b9XriCcU2aU8WGmgaSb1kauKec9kwIEzPjCGK0pKGLuJ1KZ9EkI/Fk lVihslgh8/TyJ2v7JC84VK5X4tf1lpbyautjwYGcvQO/IETYICnzyVOeQi0OzCM+2PBS gvA2w0Tq9KCQEAL04tF8O1KDxJXK7MDrmpSIm312Qtd+1bdrLeTCU3H79TFOxZkuynT9 hcRxSEJwhVU5cZzYJhEMePpcs3Q5c6ydaWsn5QhkgzsQS3slwxEEFSaFH0ZCtJB5VABX EbKg== X-Gm-Message-State: AOAM5302Iy5rOgjiPpLMRUCjlJwyUmVfvCJfrUShO+0uo7kJVaap3ToK cNxbSoNQKGKF9d9Yy84f5Cptz7Eo+nY= X-Google-Smtp-Source: ABdhPJwKEJLpOIscElgBg2ZRzoImbzpAH9ybOM4ukSzn8IS1BUPw8XjTPKoqOaD6RNw8KXN82amIKA== X-Received: by 2002:a05:6e02:1c89:: with SMTP id w9mr12099458ill.189.1635350867694; Wed, 27 Oct 2021 09:07:47 -0700 (PDT) Received: from localhost.localdomain ([2600:1008:b008:ef4c:c2c8:d0b2:872f:235b]) by smtp.googlemail.com with ESMTPSA id v26sm148670iox.35.2021.10.27.09.07.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Oct 2021 09:07:47 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v2 2/6] Benchtests: Add benchtests for __memcmpeq Date: Wed, 27 Oct 2021 11:07:37 -0500 Message-Id: <20211027160737.1987445-1-goldstein.w.n@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211027024323.1199441-2-goldstein.w.n@gmail.com> References: <20211027024323.1199441-2-goldstein.w.n@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 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-Patchwork-Original-From: Noah Goldstein via Libc-alpha From: Noah Goldstein Reply-To: Noah Goldstein Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" 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. Reviewed-by: H.J. Lu --- 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"