From b3126dc77d6b9d35d74762edcbf2edc7bd4fec09 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 28 May 2026 18:50:16 +0200 Subject: [PATCH] target/i386: add more easy cases to gen_eflags_adcox prepare_update_cf() sometimes results in CC_OP_ADCX, so this improves a bit the handling of BT+RCL and the like. Signed-off-by: Paolo Bonzini --- target/i386/tcg/emit.c.inc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc index 8eca66b696..83c889cc3b 100644 --- a/target/i386/tcg/emit.c.inc +++ b/target/i386/tcg/emit.c.inc @@ -3332,17 +3332,21 @@ static bool gen_eflags_adcox(DisasContext *s, X86DecodedInsn *decode, bool want_ * to be followed by rotations within the same basic block. */ switch (s->cc_op) { + case CC_OP_ADCX: + case CC_OP_ADOX: case CC_OP_ADCOX: /* No need to compute the full EFLAGS, CF/OF are already isolated. */ - tcg_gen_mov_tl(decode->cc_src, cpu_cc_src); - if (need_flags) { + if (s->cc_op != CC_OP_ADCX && need_flags) { tcg_gen_mov_tl(decode->cc_src2, cpu_cc_src2); got_of = true; } - if (want_carry || need_flags) { + if (s->cc_op != CC_OP_ADOX && (want_carry || need_flags)) { tcg_gen_mov_tl(decode->cc_dst, cpu_cc_dst); got_cf = true; } + /* fallthrough */ + case CC_OP_EFLAGS: + tcg_gen_mov_tl(decode->cc_src, cpu_cc_src); break; case CC_OP_LOGICB ... CC_OP_LOGICQ: