public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: Wilco Dijkstra <Wilco.Dijkstra@arm.com>,
	'GNU C Library' <libc-alpha@sourceware.org>
Subject: Re: [PATCH] Benchtests: Remove simple_memcmp
Date: Wed, 8 Mar 2023 12:23:33 -0300	[thread overview]
Message-ID: <72e2fa14-6599-454c-341c-d393aff00f58@linaro.org> (raw)
In-Reply-To: <PAWPR08MB89825054F6DC5176D969D8C583B49@PAWPR08MB8982.eurprd08.prod.outlook.com>



On 08/03/23 08:02, Wilco Dijkstra via Libc-alpha wrote:
> 
> Remove the slow byte oriented simple_memcmp.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> 
> ---
> 
> diff --git a/benchtests/bench-memcmp.c b/benchtests/bench-memcmp.c
> index a9379530656f474433ed6d852f75f71b1a1eb385..4d2b8cbb30b1d847ecde540be9f0049dd5249acf 100644
> --- a/benchtests/bench-memcmp.c
> +++ b/benchtests/bench-memcmp.c
> @@ -19,46 +19,16 @@
>  #define TEST_MAIN
>  #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
> -
> -int
> -SIMPLE_MEMCMP (const wchar_t *s1, const wchar_t *s2, size_t n)
> -{
> -  int ret = 0;
> -  /* Warning!
> -	wmemcmp has to use SIGNED comparison for elements.
> -	memcmp has to use UNSIGNED comparison for elemnts.
> -  */
> -  while (n-- && (ret = *s1 < *s2 ? -1 : *s1 == *s2 ? 0 : 1) == 0) {s1++; s2++;}
> -  return ret;
> -}
> -#else
> -# include <limits.h>
> -
> -int
> -SIMPLE_MEMCMP (const char *s1, const char *s2, size_t n)
> -{
> -  int ret = 0;
> -
> -  while (n-- && (ret = *(unsigned char *) s1++ - *(unsigned char *) s2++) == 0);
> -  return ret;
> -}
> -#endif
> -
> -# include "json-lib.h"
> +#include "json-lib.h"
>  
>  typedef int (*proto_t) (const CHAR *, const CHAR *, size_t);
>  
> -IMPL (SIMPLE_MEMCMP, 0)
>  IMPL (MEMCMP, 1)
>  
>  static void
> 

      reply	other threads:[~2023-03-08 15:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-08 11:02 Wilco Dijkstra
2023-03-08 15:23 ` Adhemerval Zanella Netto [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=72e2fa14-6599-454c-341c-d393aff00f58@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=Wilco.Dijkstra@arm.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).