diff mbox series

[v2,27/50] target/i386: Fix the comment for repz_opt

Message ID 20210514151342.384376-28-richard.henderson@linaro.org
State New
Headers show
Series target/i386 translate cleanups | expand

Commit Message

Richard Henderson May 14, 2021, 3:13 p.m. UTC
After fixing a typo in the comment, fixup for CODING_STYLE.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/i386/tcg/translate.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

Comments

Paolo Bonzini May 18, 2021, 9:48 a.m. UTC | #1
On 14/05/21 17:13, Richard Henderson wrote:
> After fixing a typo in the comment, fixup for CODING_STYLE.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/i386/tcg/translate.c | 19 ++++++++++---------
>   1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
> index b9b94f0625..d48c0f82a9 100644
> --- a/target/i386/tcg/translate.c
> +++ b/target/i386/tcg/translate.c
> @@ -8521,15 +8521,16 @@ static void i386_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu)
>       dc->cpuid_xsave_features = env->features[FEAT_XSAVE];
>       dc->jmp_opt = !(dc->base.singlestep_enabled ||
>                       (flags & (HF_TF_MASK | HF_INHIBIT_IRQ_MASK)));
> -    /* Do not optimize repz jumps at all in icount mode, because
> -       rep movsS instructions are execured with different paths
> -       in !repz_opt and repz_opt modes. The first one was used
> -       always except single step mode. And this setting
> -       disables jumps optimization and control paths become
> -       equivalent in run and single step modes.
> -       Now there will be no jump optimization for repz in
> -       record/replay modes and there will always be an
> -       additional step for ecx=0 when icount is enabled.
> +    /*
> +     * Do not optimize repz jumps at all in icount mode, because
> +     * rep movsS instructions are executed with different paths
> +     * in !repz_opt and repz_opt modes. The first one was used
> +     * always except single step mode. And this setting
> +     * disables jumps optimization and control paths become
> +     * equivalent in run and single step modes.
> +     * Now there will be no jump optimization for repz in
> +     * record/replay modes and there will always be an
> +     * additional step for ecx=0 when icount is enabled.
>        */
>       dc->repz_opt = !dc->jmp_opt && !(tb_cflags(dc->base.tb) & CF_USE_ICOUNT);
>   
> 

The comment is still quite unreadable, so perhaps something like this

	/*
	 * If jmp_opt, we want to handle each string instruction individually.
	 * For icount also disable repz optimization so that each iteration
	 * is accounted separately.
	 */

Paolo
diff mbox series

Patch

diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
index b9b94f0625..d48c0f82a9 100644
--- a/target/i386/tcg/translate.c
+++ b/target/i386/tcg/translate.c
@@ -8521,15 +8521,16 @@  static void i386_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu)
     dc->cpuid_xsave_features = env->features[FEAT_XSAVE];
     dc->jmp_opt = !(dc->base.singlestep_enabled ||
                     (flags & (HF_TF_MASK | HF_INHIBIT_IRQ_MASK)));
-    /* Do not optimize repz jumps at all in icount mode, because
-       rep movsS instructions are execured with different paths
-       in !repz_opt and repz_opt modes. The first one was used
-       always except single step mode. And this setting
-       disables jumps optimization and control paths become
-       equivalent in run and single step modes.
-       Now there will be no jump optimization for repz in
-       record/replay modes and there will always be an
-       additional step for ecx=0 when icount is enabled.
+    /*
+     * Do not optimize repz jumps at all in icount mode, because
+     * rep movsS instructions are executed with different paths
+     * in !repz_opt and repz_opt modes. The first one was used
+     * always except single step mode. And this setting
+     * disables jumps optimization and control paths become
+     * equivalent in run and single step modes.
+     * Now there will be no jump optimization for repz in
+     * record/replay modes and there will always be an
+     * additional step for ecx=0 when icount is enabled.
      */
     dc->repz_opt = !dc->jmp_opt && !(tb_cflags(dc->base.tb) & CF_USE_ICOUNT);