qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] target/i386: tcg: high bits SSE cmp operation must be ignored
@ 2022-03-24  8:08 Paolo Bonzini
  2022-03-25 14:48 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2022-03-24  8:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: sonicadvance1

High bits in the immediate operand of SSE comparisons are ignored, they
do not result in an undefined opcode exception.  This is mentioned
explicitly in the Intel documentation.

Reported-by: sonicadvance1@gmail.com
Closes: https://gitlab.com/qemu-project/qemu/-/issues/184
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/tcg/translate.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
index 2a94d33742..c393913fe0 100644
--- a/target/i386/tcg/translate.c
+++ b/target/i386/tcg/translate.c
@@ -4509,10 +4509,8 @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b,
             sse_fn_ppi(s->ptr0, s->ptr1, tcg_const_i32(val));
             break;
         case 0xc2:
-            /* compare insns */
-            val = x86_ldub_code(env, s);
-            if (val >= 8)
-                goto unknown_op;
+            /* compare insns, bits 7:3 (7:5 for AVX) are ignored */
+            val = x86_ldub_code(env, s) & 7;
             sse_fn_epp = sse_op_table4[val][b1];
 
             tcg_gen_addi_ptr(s->ptr0, cpu_env, op1_offset);
-- 
2.35.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] target/i386: tcg: high bits SSE cmp operation must be ignored
  2022-03-24  8:08 [PATCH] target/i386: tcg: high bits SSE cmp operation must be ignored Paolo Bonzini
@ 2022-03-25 14:48 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2022-03-25 14:48 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: sonicadvance1

On 3/24/22 02:08, Paolo Bonzini wrote:
> High bits in the immediate operand of SSE comparisons are ignored, they
> do not result in an undefined opcode exception.  This is mentioned
> explicitly in the Intel documentation.
> 
> Reported-by:sonicadvance1@gmail.com
> Closes:https://gitlab.com/qemu-project/qemu/-/issues/184
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
>   target/i386/tcg/translate.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)

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

r~


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-25 14:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-24  8:08 [PATCH] target/i386: tcg: high bits SSE cmp operation must be ignored Paolo Bonzini
2022-03-25 14:48 ` 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).