@samitouri / QOSamiQemu / commits / b3126dc77d

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 <pbonzini@redhat.com>

Paolo Bonzini committed May 28, 2026 at 18:50 UTC b3126dc77d6b9d35d74762edcbf2edc7bd4fec09
1 file changed +7 -3
target/i386/tcg/emit.c.inc
+7 -3
@@ -3332,17 +3332,21 @@ static bool gen_eflags_adcox(DisasContext *s, X86DecodedInsn *decode, bool want_
3332 * to be followed by rotations within the same basic block.
3333 */
3334 switch (s->cc_op) {
3335 + case CC_OP_ADCX:
3336 + case CC_OP_ADOX:
3337 case CC_OP_ADCOX:
3338 /* No need to compute the full EFLAGS, CF/OF are already isolated. */
3337 - tcg_gen_mov_tl(decode->cc_src, cpu_cc_src);
3338 - if (need_flags) {
3339 + if (s->cc_op != CC_OP_ADCX && need_flags) {
3340 tcg_gen_mov_tl(decode->cc_src2, cpu_cc_src2);
3341 got_of = true;
3342 }
3342 - if (want_carry || need_flags) {
3343 + if (s->cc_op != CC_OP_ADOX && (want_carry || need_flags)) {
3344 tcg_gen_mov_tl(decode->cc_dst, cpu_cc_dst);
3345 got_cf = true;
3346 }
3347 + /* fallthrough */
3348 + case CC_OP_EFLAGS:
3349 + tcg_gen_mov_tl(decode->cc_src, cpu_cc_src);
3350 break;
3351
3352 case CC_OP_LOGICB ... CC_OP_LOGICQ: