qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Michael Clark <mjc@sifive.com>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Palmer Dabbelt <palmer@sifive.com>
Subject: Re: [Qemu-devel] [PATCH] RISC-V: Fix isa string logic bug, use popcount to count bits
Date: Fri, 9 Mar 2018 14:33:23 -0600	[thread overview]
Message-ID: <f02255ad-f0f9-9e7e-8ae7-6c588e41126a@redhat.com> (raw)
In-Reply-To: <1520626818-93348-1-git-send-email-mjc@sifive.com>

[resend, this time with proper cc's]

On 03/09/2018 02:20 PM, Michael Clark wrote:
> Cc: Palmer Dabbelt <palmer@sifive.com>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Michael Clark <mjc@sifive.com>
> ---
>   target/riscv/cpu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
> index 4851890..f0d6d1d 100644
> --- a/target/riscv/cpu.c
> +++ b/target/riscv/cpu.c
> @@ -391,7 +391,7 @@ static const TypeInfo riscv_cpu_type_info = {
>   char *riscv_isa_string(RISCVCPU *cpu)
>   {
>       int i;
> -    size_t maxlen = 5 + ctz32(cpu->env.misa);
> +    size_t maxlen = 5 + __builtin_popcountll(cpu->env.misa);
>       char *isa_string = g_new0(char, maxlen);
>       snprintf(isa_string, maxlen, "rv%d", TARGET_LONG_BITS);
>       for (i = 0; i < sizeof(riscv_exts); i++) {

I'd rather you used ctpop64() from host-utils.h, so we have a 
centralized place to change things just once in case we have to tweak 
the use of __builtin_popcount when targetting a different compiler.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

  parent reply	other threads:[~2018-03-09 20:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-09 20:20 [Qemu-devel] [PATCH] RISC-V: Fix isa string logic bug, use popcount to count bits Michael Clark
2018-03-09 20:32 ` Eric Blake
2018-03-09 20:33 ` Eric Blake [this message]
2018-03-09 20:50   ` Michael Clark

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=f02255ad-f0f9-9e7e-8ae7-6c588e41126a@redhat.com \
    --to=eblake@redhat.com \
    --cc=mjc@sifive.com \
    --cc=palmer@sifive.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.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 NNTP newsgroup(s).