diff mbox series

[19/46] tcg/optimize: Use fold_masks_zs in fold_movcond

Message ID 20241210152401.1823648-20-richard.henderson@linaro.org
State New
Headers show
Series tcg: Remove in-flight mask data from OptContext | expand

Commit Message

Richard Henderson Dec. 10, 2024, 3:23 p.m. UTC
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 tcg/optimize.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Pierrick Bouvier Dec. 17, 2024, 8:27 p.m. UTC | #1
On 12/10/24 07:23, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   tcg/optimize.c | 11 ++++++-----
>   1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/tcg/optimize.c b/tcg/optimize.c
> index 260e3ea072..6d2d55f053 100644
> --- a/tcg/optimize.c
> +++ b/tcg/optimize.c
> @@ -1874,6 +1874,7 @@ static bool fold_mov(OptContext *ctx, TCGOp *op)
>   
>   static bool fold_movcond(OptContext *ctx, TCGOp *op)
>   {
> +    uint64_t z_mask, s_mask;
>       int i;
>   
>       /* If true and false values are the same, eliminate the cmp. */
> @@ -1895,10 +1896,10 @@ static bool fold_movcond(OptContext *ctx, TCGOp *op)
>           return tcg_opt_gen_mov(ctx, op, op->args[0], op->args[4 - i]);
>       }
>   
> -    ctx->z_mask = arg_info(op->args[3])->z_mask
> -                | arg_info(op->args[4])->z_mask;
> -    ctx->s_mask = arg_info(op->args[3])->s_mask
> -                & arg_info(op->args[4])->s_mask;
> +    z_mask = arg_info(op->args[3])->z_mask
> +           | arg_info(op->args[4])->z_mask;
> +    s_mask = arg_info(op->args[3])->s_mask
> +           & arg_info(op->args[4])->s_mask;
>   
>       if (arg_is_const(op->args[3]) && arg_is_const(op->args[4])) {
>           uint64_t tv = arg_info(op->args[3])->val;
> @@ -1941,7 +1942,7 @@ static bool fold_movcond(OptContext *ctx, TCGOp *op)
>               }
>           }
>       }
> -    return false;
> +    return fold_masks_zs(ctx, op, z_mask, s_mask);
>   }
>   
>   static bool fold_mul(OptContext *ctx, TCGOp *op)

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
diff mbox series

Patch

diff --git a/tcg/optimize.c b/tcg/optimize.c
index 260e3ea072..6d2d55f053 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1874,6 +1874,7 @@  static bool fold_mov(OptContext *ctx, TCGOp *op)
 
 static bool fold_movcond(OptContext *ctx, TCGOp *op)
 {
+    uint64_t z_mask, s_mask;
     int i;
 
     /* If true and false values are the same, eliminate the cmp. */
@@ -1895,10 +1896,10 @@  static bool fold_movcond(OptContext *ctx, TCGOp *op)
         return tcg_opt_gen_mov(ctx, op, op->args[0], op->args[4 - i]);
     }
 
-    ctx->z_mask = arg_info(op->args[3])->z_mask
-                | arg_info(op->args[4])->z_mask;
-    ctx->s_mask = arg_info(op->args[3])->s_mask
-                & arg_info(op->args[4])->s_mask;
+    z_mask = arg_info(op->args[3])->z_mask
+           | arg_info(op->args[4])->z_mask;
+    s_mask = arg_info(op->args[3])->s_mask
+           & arg_info(op->args[4])->s_mask;
 
     if (arg_is_const(op->args[3]) && arg_is_const(op->args[4])) {
         uint64_t tv = arg_info(op->args[3])->val;
@@ -1941,7 +1942,7 @@  static bool fold_movcond(OptContext *ctx, TCGOp *op)
             }
         }
     }
-    return false;
+    return fold_masks_zs(ctx, op, z_mask, s_mask);
 }
 
 static bool fold_mul(OptContext *ctx, TCGOp *op)