diff mbox series

[10/46] tcg/optimize: Use fold_masks_z in fold_ctpop

Message ID 20241210152401.1823648-11-richard.henderson@linaro.org (mailing list archive)
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 | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Pierrick Bouvier Dec. 17, 2024, 8:19 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 | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/tcg/optimize.c b/tcg/optimize.c
> index c97ec10989..424ed7674d 100644
> --- a/tcg/optimize.c
> +++ b/tcg/optimize.c
> @@ -1598,22 +1598,23 @@ static bool fold_count_zeros(OptContext *ctx, TCGOp *op)
>   
>   static bool fold_ctpop(OptContext *ctx, TCGOp *op)
>   {
> +    uint64_t z_mask;
> +
>       if (fold_const1(ctx, op)) {
>           return true;
>       }
>   
>       switch (ctx->type) {
>       case TCG_TYPE_I32:
> -        ctx->z_mask = 32 | 31;
> +        z_mask = 32 | 31;
>           break;
>       case TCG_TYPE_I64:
> -        ctx->z_mask = 64 | 63;
> +        z_mask = 64 | 63;
>           break;
>       default:
>           g_assert_not_reached();
>       }
> -    ctx->s_mask = smask_from_zmask(ctx->z_mask);
> -    return false;
> +    return fold_masks_z(ctx, op, z_mask);
>   }
>   
>   static bool fold_deposit(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 c97ec10989..424ed7674d 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1598,22 +1598,23 @@  static bool fold_count_zeros(OptContext *ctx, TCGOp *op)
 
 static bool fold_ctpop(OptContext *ctx, TCGOp *op)
 {
+    uint64_t z_mask;
+
     if (fold_const1(ctx, op)) {
         return true;
     }
 
     switch (ctx->type) {
     case TCG_TYPE_I32:
-        ctx->z_mask = 32 | 31;
+        z_mask = 32 | 31;
         break;
     case TCG_TYPE_I64:
-        ctx->z_mask = 64 | 63;
+        z_mask = 64 | 63;
         break;
     default:
         g_assert_not_reached();
     }
-    ctx->s_mask = smask_from_zmask(ctx->z_mask);
-    return false;
+    return fold_masks_z(ctx, op, z_mask);
 }
 
 static bool fold_deposit(OptContext *ctx, TCGOp *op)