Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: Jim Wilson <jim.wilson@linaro.org>
Cc: gdb-patches@sourceware.org
Subject: popcount support
Date: Mon, 13 Mar 2017 04:41:00 -0000	[thread overview]
Message-ID: <20170313044143.GV31094@vapier> (raw)
In-Reply-To: <CABXYE2W2z-n+d_QZvH6epMcS-zerQYaimz475DxSuXd4Ebtm4w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 660 bytes --]

On 25 Feb 2017 19:53, Jim Wilson wrote:
> +/* Return the number of bits set in the input value.  */
> +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
> +# define popcount __builtin_popcount
> +#else
> +static int
> +popcount (unsigned char x)
> +{
> +  static const unsigned char popcnt[16] =
> +    {
> +      0, 1, 1, 2,
> +      1, 2, 2, 3,
> +      1, 2, 2, 3,
> +      2, 3, 3, 4
> +    };
> +
> +  /* Only counts the low 8 bits of the input as that is all we need.  */
> +  return popcnt[x % 16] + popcnt[x / 16];
> +}
> +#endif

gas/config/tc-ia64.c does the same thing, and bfd/elf32-arm.c.
should we consolidate these in libiberty ?
-mike

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2017-03-13  4:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-26  3:54 [PATCH] aarch64 sim, add cnt insn support Jim Wilson
2017-03-13  4:41 ` Mike Frysinger [this message]
2017-03-14  3:59   ` popcount support Jim Wilson

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=20170313044143.GV31094@vapier \
    --to=vapier@gentoo.org \
    --cc=gdb-patches@sourceware.org \
    --cc=jim.wilson@linaro.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