From patchwork Sun Jun 4 16:47:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 20782 Received: (qmail 36814 invoked by alias); 4 Jun 2017 16:47:59 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 36798 invoked by uid 89); 4 Jun 2017 16:47:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qt0-f174.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=zdn98uAMI/1l7hJHK5M2n+9EMjB4K4X1nknzSeJdeAs=; b=pMAqYal8W5F/D/YHXVAnXCbSpPCUxnMVKj6rDxdh6Fh7N0B0BZV2e7XvRDulXQEoiI EyJRnyO/EXKzCPz2xtZMwVJRs1kOhpzDsL1ISKKnIQBp4x/WiNphAJ0qD6U6zGf1oCA/ UffXhrdF83PF5k0iMuSLEY4qJIoeblknrWsBledXPZzG08d1iY6GPfrVc6be0E+QF1O5 H+SwalhmzTDbray4wVGA8QaBmwyS3DWGauEgj9Bnl+/nobszsOiVFrgkHoDmGkFA+htB ykf5i7+QxpDX4e1wh6djaTgoJBQhAj+ys4NRnxaYIbNBeYx34KoXkja5Em/bxxMS4LjQ CsSg== X-Gm-Message-State: AKS2vOzIPO8x+FEEyopwPH9A1O7BPS2Qe+rCI8+6LgIApVPXrSWci9x0 5bm9tygf6fc2H84z9NOk6DWtQ+o+kg== X-Received: by 10.55.128.199 with SMTP id b190mr20156495qkd.21.1496594879857; Sun, 04 Jun 2017 09:47:59 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <20170524154422.GA14778@lucon.org> From: "H.J. Lu" Date: Sun, 4 Jun 2017 09:47:59 -0700 Message-ID: Subject: Re: [PATCH] benchtests: Add more tests for memrchr To: Rajalakshmi Srinivasaraghavan Cc: GNU C Library On Thu, May 25, 2017 at 12:17 AM, Rajalakshmi Srinivasaraghavan wrote: > > > On 05/24/2017 09:14 PM, H.J. Lu wrote: >> >> FOR_EACH_IMPL (impl, 0) >> do_one_test (impl, (CHAR *) (buf + align), seek_char, len, result); >> @@ -143,11 +144,27 @@ test_main (void) >> do_test (i, 64, 256, 23); >> do_test (0, 16 << i, 2048, 0); >> do_test (i, 64, 256, 0); >> +#ifdef USE_AS_MEMRCHR >> + /* Also test the position close to the beginning for memrchr. */ >> + do_test (0, i, 256, 23); >> + do_test (0, i, 256, 0); >> + do_test (i, i, 256, 23); >> + do_test (i, i, 256, 0); >> +#endif >> } >> for (i = 1; i < 32; ++i) >> { >> do_test (0, i, i + 1, 23); >> do_test (0, i, i + 1, 0); >> + do_test (i, i, i + 1, 23); >> + do_test (i, i, i + 1, 0); >> +#ifdef USE_AS_MEMRCHR >> + /* Also test the position close to the beginning for memrchr. */ >> + do_test (0, 1, i + 1, 23); >> + do_test (0, 2, i + 1, 0); >> + do_test (i, i, i + 1, 23); >> + do_test (i, i, i + 1, 0); > > > The above two lines are repeating, instead of > do_test (i, 1, i + 1, 23); > do_test (i, 2, i + 1, 0); > > LGTM with the above change. > > >> +#endif >> } >> >> return ret; >> -- 2.9.4 >> This is what I am going to check in. Thanks. From 6b69f98dcd34d63e507cae1d8bfe83ea8d597830 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sun, 4 Jun 2017 09:44:48 -0700 Subject: [PATCH] benchtests: Add more tests for memrchr bench-memchr.c is shared with bench-memrchr.c. This patch adds some tests for positions close to the beginning for memrchr, which are equivalent to positions close to the end for memchr. * benchtests/bench-memchr.c (do_test): Print out both length and position. (test_main): Also test the position close to the beginning for memrchr. --- ChangeLog | 7 +++++++ benchtests/bench-memchr.c | 17 ++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 055e7af..9e824d5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-06-04 H.J. Lu + + * benchtests/bench-memchr.c (do_test): Print out both length + and position. + (test_main): Also test the position close to the beginning for + memrchr. + 2017-06-04 Zack Weinberg * nis/nis_add.c, nis/nis_addmember.c, nis/nis_call.c diff --git a/benchtests/bench-memchr.c b/benchtests/bench-memchr.c index 16099ac..92b5b7f 100644 --- a/benchtests/bench-memchr.c +++ b/benchtests/bench-memchr.c @@ -117,7 +117,8 @@ do_test (size_t align, size_t pos, size_t len, int seek_char) buf[align + len] = seek_char; } - printf ("Length %4zd, alignment %2zd:", pos, align); + printf ("Length %4zd, position %4zd, alignment %2zd:", + len, pos, align); FOR_EACH_IMPL (impl, 0) do_one_test (impl, (CHAR *) (buf + align), seek_char, len, result); @@ -143,11 +144,25 @@ test_main (void) do_test (i, 64, 256, 23); do_test (0, 16 << i, 2048, 0); do_test (i, 64, 256, 0); +#ifdef USE_AS_MEMRCHR + /* Also test the position close to the beginning for memrchr. */ + do_test (0, i, 256, 23); + do_test (0, i, 256, 0); + do_test (i, i, 256, 23); + do_test (i, i, 256, 0); +#endif } for (i = 1; i < 32; ++i) { do_test (0, i, i + 1, 23); do_test (0, i, i + 1, 0); + do_test (i, i, i + 1, 23); + do_test (i, i, i + 1, 0); +#ifdef USE_AS_MEMRCHR + /* Also test the position close to the beginning for memrchr. */ + do_test (0, 1, i + 1, 23); + do_test (0, 2, i + 1, 0); +#endif } return ret; -- 2.9.4