target/i386: execute multiple REP/REPZ iterations without leaving TB
authorPaolo Bonzini <pbonzini@redhat.com>
Sun, 15 Dec 2024 09:06:10 +0000 (10:06 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 23 Jan 2025 10:35:33 +0000 (11:35 +0100)
commit456709db50f424d112bc5f07260fdc51555f3a24
tree3ee86b3cd8dd3278869f31895092702c948d8963
parent0360b781870a628379de20e03305c4e62dbdcca4
target/i386: execute multiple REP/REPZ iterations without leaving TB

Use a TCG loop so that it is not necessary to go through the setup steps
of REP and through the I/O check on every iteration.  Interestingly, this
is not a particularly effective optimization on its own, though it avoids
the cost of correct RF emulation that was added in the previous patch.
The main benefit lies in allowing the hoisting of loop invariants outside
the loop, which will happen separately.

The loop exits when the low 16 bits of CX/ECX/RCX are zero (so generally
speaking the string operation runs in 65536 iteration batches) to give
the main loop an opportunity to pick up interrupts.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Link: https://lore.kernel.org/r/20241215090613.89588-12-pbonzini@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target/i386/tcg/translate.c