On 12/15/24 03:06, Paolo Bonzini wrote:
+
+ /*
+ * The last iteration is handled outside the loop, so that cx_next
+ * can never underflow.
+ */
+ if (can_loop) {
+ tcg_gen_brcondi_tl(TCG_COND_TSTEQ, cx_next, cx_mask, last);
+ }
+
+ gen_set_label(loop);
I know unused labels will get eliminated, but clearer if you emit the label within the IF
as well.
@@ -1384,6 +1409,12 @@ static void do_gen_rep(DisasContext *s, MemOp ot,
gen_jcc_noeob(s, (JCC_Z << 1) | (nz ^ 1), done);
}
+ if (can_loop) {
+ tcg_gen_subi_tl(cx_next, cpu_regs[R_ECX], 1);
Since we've just written back cx_next to ECX, this is the same as cx_next -= 1,
yes?
Anyway,
Reviewed-by: Richard Henderson <richard.hender...@linaro.org>
r~