Skip to content

Commit

Permalink
target/i386: tcg: high bits SSE cmp operation must be ignored
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
bonzini committed Mar 24, 2022
1 parent 98a02bc commit de65b39
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions target/i386/tcg/translate.c
Expand Up @@ -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);
Expand Down

0 comments on commit de65b39

Please sign in to comment.