From da7649c6aeef22a8c005ef678cb9cf3a7c2d4253 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Sat, 22 Nov 2025 23:02:10 +0100 Subject: [PATCH] target/i386/tcg: do not compute all flags for SAHF Only OF is needed, the others are overwritten. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/emit.c.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc index 22e53f5b00..131aefce53 100644 --- a/target/i386/tcg/emit.c.inc +++ b/target/i386/tcg/emit.c.inc @@ -3778,7 +3778,7 @@ static void gen_SAHF(DisasContext *s, X86DecodedInsn *decode) return gen_illegal_opcode(s); } tcg_gen_shri_tl(s->T0, cpu_regs[R_EAX], 8); - gen_compute_eflags(s); + gen_neg_setcc(s, JCC_O << 1, cpu_cc_src); tcg_gen_andi_tl(cpu_cc_src, cpu_cc_src, CC_O); tcg_gen_andi_tl(s->T0, s->T0, CC_S | CC_Z | CC_A | CC_P | CC_C); tcg_gen_or_tl(cpu_cc_src, cpu_cc_src, s->T0);