From: Richard Henderson <richard.henderson@linaro.org>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: Lenard Szolnoki <blog@lenardszolnoki.com>
Subject: Re: [PATCH] target/i386: fix operand order for PDEP and PEXT
Date: Tue, 24 Nov 2020 09:54:32 -0800 [thread overview]
Message-ID: <ee22951a-6e40-67d4-c0b0-7df096572ea5@linaro.org> (raw)
In-Reply-To: <20201123131426.2725276-1-pbonzini@redhat.com>
On 11/23/20 5:14 AM, Paolo Bonzini wrote:
> For PDEP and PEXT, the mask is provided in the memory (mod+r/m)
> operand, and therefore is loaded in s->T0 by gen_ldst_modrm.
> The source is provided in the second source operand (VEX.vvvv)
> and therefore is loaded in s->T1. Fix the order in which
> they are passed to the helpers.
>
> Reported-by: Lenard Szolnoki <blog@lenardszolnoki.com>
> Analyzed-by: Lenard Szolnoki <blog@lenardszolnoki.com>
> Fixes: https://bugs.launchpad.net/qemu/+bug/1605123
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
The patch itself looks fine.
> +test-i386-bmi2: CFLAGS += -mbmi2
> +run-test-i386-bmi2: QEMU_OPTS += -cpu max
> +run-plugin-test-i386-bmi2-%: QEMU_OPTS += -cpu max
I suspect that we still support host operating systems whose compilers do not
support -mbmi2. This might require a bit in tests/tcg/configure.sh akin to
CROSS_CC_HAS_ARMV8_3.
> +int main(int argc, char *argv[]) {
> + char hello[16];
> + uint64_t ehlo = 0x202020204f4c4845ull;
> + uint64_t mask = 0xa080800302020001ull;
> + uint64_t result64;
> + uint32_t result32;
> +
> + /* 64 bits */
> + asm volatile ("pextq %2, %1, %0" : "=r"(result64) : "r"(ehlo), "m"(mask));
> + assert(result64 == 133);
The test is written for x86_64 not i386. How are we preventing the test case
from being run on 32-bit in the makefile?
> + /* 32 bits */
> + asm volatile ("pextl %2, %k1, %k0" : "=r"(result32) : "r"(ehlo), "m"(mask));
> + assert(result32 == 5);
Surely we should test the full 64-bit register result, and not truncate to
uint32_t in the output variable?
r~
next prev parent reply other threads:[~2020-11-24 17:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-23 13:14 [PATCH] target/i386: fix operand order for PDEP and PEXT Paolo Bonzini
2020-11-23 13:21 ` no-reply
2020-11-24 17:54 ` Richard Henderson [this message]
2020-11-24 19:44 ` Paolo Bonzini
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=ee22951a-6e40-67d4-c0b0-7df096572ea5@linaro.org \
--to=richard.henderson@linaro.org \
--cc=blog@lenardszolnoki.com \
--cc=pbonzini@redhat.com \
--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).