[PATCH v2 04/25] target/i386: cc_op is not dynamic in gen_jcc1

Paolo Bonzini posted 25 patches 6 months, 3 weeks ago
[PATCH v2 04/25] target/i386: cc_op is not dynamic in gen_jcc1
Posted by Paolo Bonzini 6 months, 3 weeks ago
Resetting cc_op to CC_OP_DYNAMIC should be done at control flow junctions,
which is not the case here.  This translation block is ending and the
only effect of calling set_cc_op() would be a discard of s->cc_srcT.
This discard is useless (it's a temporary, not a global) and in fact
prevents gen_prepare_cc from returning s->cc_srcT.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/tcg/translate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
index 9aecd415b38..3f1d2858fc9 100644
--- a/target/i386/tcg/translate.c
+++ b/target/i386/tcg/translate.c
@@ -1227,13 +1227,13 @@ static inline void gen_jcc1_noeob(DisasContext *s, int b, TCGLabel *l1)
 
 /* Generate a conditional jump to label 'l1' according to jump opcode
    value 'b'. In the fast case, T0 is guaranteed not to be used.
-   A translation block must end soon.  */
+   One or both of the branches will call gen_jmp_rel, so ensure
+   cc_op is clean.  */
 static inline void gen_jcc1(DisasContext *s, int b, TCGLabel *l1)
 {
     CCPrepare cc = gen_prepare_cc(s, b, s->T0);
 
     gen_update_cc_op(s);
-    set_cc_op(s, CC_OP_DYNAMIC);
     if (cc.use_reg2) {
         tcg_gen_brcond_tl(cc.cond, cc.reg, cc.reg2, l1);
     } else {
-- 
2.45.0
Re: [PATCH v2 04/25] target/i386: cc_op is not dynamic in gen_jcc1
Posted by Richard Henderson 6 months, 3 weeks ago
On 5/6/24 01:09, Paolo Bonzini wrote:
> Resetting cc_op to CC_OP_DYNAMIC should be done at control flow junctions,
> which is not the case here.  This translation block is ending and the
> only effect of calling set_cc_op() would be a discard of s->cc_srcT.
> This discard is useless (it's a temporary, not a global) and in fact
> prevents gen_prepare_cc from returning s->cc_srcT.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   target/i386/tcg/translate.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~