* [PATCH] target/i386: correctly mask SSE4a bit indices in register operands
@ 2022-09-18 7:18 Paolo Bonzini
2022-09-20 3:46 ` Richard Henderson
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2022-09-18 7:18 UTC (permalink / raw)
To: qemu-devel
SSE4a instructions EXTRQ and INSERTQ have two bit index operands, that can be
immediates or taken from an XMM register. In both cases, the fields are
6-bit wide and the top two bits in the byte are ignored. translate.c is
doing that correctly for the immediate case, but not for the XMM case, so
fix it.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/ops_sse.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/i386/ops_sse.h b/target/i386/ops_sse.h
index c0766de18d..3504bca36a 100644
--- a/target/i386/ops_sse.h
+++ b/target/i386/ops_sse.h
@@ -926,7 +926,7 @@ static inline uint64_t helper_extrq(uint64_t src, int shift, int len)
void helper_extrq_r(CPUX86State *env, ZMMReg *d, ZMMReg *s)
{
- d->ZMM_Q(0) = helper_extrq(d->ZMM_Q(0), s->ZMM_B(1), s->ZMM_B(0));
+ d->ZMM_Q(0) = helper_extrq(d->ZMM_Q(0), s->ZMM_B(1) & 63, s->ZMM_B(0) & 63);
}
void helper_extrq_i(CPUX86State *env, ZMMReg *d, int index, int length)
@@ -948,7 +948,7 @@ static inline uint64_t helper_insertq(uint64_t src, int shift, int len)
void helper_insertq_r(CPUX86State *env, ZMMReg *d, ZMMReg *s)
{
- d->ZMM_Q(0) = helper_insertq(s->ZMM_Q(0), s->ZMM_B(9), s->ZMM_B(8));
+ d->ZMM_Q(0) = helper_insertq(s->ZMM_Q(0), s->ZMM_B(9) & 63, s->ZMM_B(8) & 63);
}
void helper_insertq_i(CPUX86State *env, ZMMReg *d, int index, int length)
--
2.37.2
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] target/i386: correctly mask SSE4a bit indices in register operands
2022-09-18 7:18 [PATCH] target/i386: correctly mask SSE4a bit indices in register operands Paolo Bonzini
@ 2022-09-20 3:46 ` Richard Henderson
0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2022-09-20 3:46 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel
On 9/18/22 09:18, Paolo Bonzini wrote:
> SSE4a instructions EXTRQ and INSERTQ have two bit index operands, that can be
> immediates or taken from an XMM register. In both cases, the fields are
> 6-bit wide and the top two bits in the byte are ignored. translate.c is
> doing that correctly for the immediate case, but not for the XMM case, so
> fix it.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> target/i386/ops_sse.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
But these aren't SSE4a, they're AMD New Media instructions, which was a bit confusing.
r~
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-20 3:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-18 7:18 [PATCH] target/i386: correctly mask SSE4a bit indices in register operands Paolo Bonzini
2022-09-20 3:46 ` Richard Henderson
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).