QEMU-Devel Archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-stable@nongnu.org
Subject: Re: [PATCH] target/i386: fix operand size for DATA16 REX.W POPCNT
Date: Fri, 10 May 2024 11:20:48 +0200	[thread overview]
Message-ID: <c27b0759-3a40-42da-88c7-88c3c8c6b245@linaro.org> (raw)
In-Reply-To: <20240509152526.141855-1-pbonzini@redhat.com>

On 5/9/24 17:25, Paolo Bonzini wrote:
> According to the manual, 32-bit vs 64-bit is governed by REX.W
> and REX ignores the 0x66 prefix.  This can be confirmed with this
> program:
> 
>      #include <stdio.h>
>      int main()
>      {
>         int x = 0x12340000;
>         int y;
>         asm("popcntl %1, %0" : "=r" (y) : "r" (x)); printf("%x\n", y);
>         asm("mov $-1, %0; .byte 0x66; popcntl %1, %0" : "+r" (y) : "r" (x)); printf("%x\n", y);
>         asm("mov $-1, %0; .byte 0x66; popcntq %q1, %q0" : "+r" (y) : "r" (x)); printf("%x\n", y);
>      }
> 
> which prints 5/ffff0000/5 on real hardware and 5/ffff0000/ffff0000
> on QEMU.
> 
> Cc:qemu-stable@nongnu.org
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
>   target/i386/tcg/translate.c | 17 +----------------
>   1 file changed, 1 insertion(+), 16 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


  reply	other threads:[~2024-05-10  9:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-09 15:25 [PATCH] target/i386: fix operand size for DATA16 REX.W POPCNT Paolo Bonzini
2024-05-10  9:20 ` Richard Henderson [this message]
2024-05-10 11:25 ` Zhao Liu

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=c27b0759-3a40-42da-88c7-88c3c8c6b245@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@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 read-only IMAP folder(s) and NNTP newsgroup(s).