diff mbox series

[36/46] tcg/optimize: Use fold_masks_zsa in fold_sextract

Message ID 20241210152401.1823648-37-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 | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Pierrick Bouvier Dec. 17, 2024, 8:42 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 | 8 +++-----
>   1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/tcg/optimize.c b/tcg/optimize.c
> index c99e6f79d2..551f96dfaa 100644
> --- a/tcg/optimize.c
> +++ b/tcg/optimize.c
> @@ -2488,7 +2488,7 @@ static bool fold_cmpsel_vec(OptContext *ctx, TCGOp *op)
>   
>   static bool fold_sextract(OptContext *ctx, TCGOp *op)
>   {
> -    uint64_t z_mask, s_mask, s_mask_old;
> +    uint64_t z_mask, s_mask, s_mask_old, a_mask = -1;
>       int pos = op->args[2];
>       int len = op->args[3];
>   
> @@ -2502,18 +2502,16 @@ static bool fold_sextract(OptContext *ctx, TCGOp *op)
>   
>       z_mask = arg_info(op->args[1])->z_mask;
>       z_mask = sextract64(z_mask, pos, len);
> -    ctx->z_mask = z_mask;
>   
>       s_mask_old = arg_info(op->args[1])->s_mask;
>       s_mask = sextract64(s_mask_old, pos, len);
>       s_mask |= MAKE_64BIT_MASK(len, 64 - len);
> -    ctx->s_mask = s_mask;
>   
>       if (pos == 0) {
> -        ctx->a_mask = s_mask & ~s_mask_old;
> +        a_mask = s_mask & ~s_mask_old;
>       }
>   
> -    return fold_masks(ctx, op);
> +    return fold_masks_zsa(ctx, op, z_mask, s_mask, a_mask);
>   }
>   
>   static bool fold_shift(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 c99e6f79d2..551f96dfaa 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -2488,7 +2488,7 @@  static bool fold_cmpsel_vec(OptContext *ctx, TCGOp *op)
 
 static bool fold_sextract(OptContext *ctx, TCGOp *op)
 {
-    uint64_t z_mask, s_mask, s_mask_old;
+    uint64_t z_mask, s_mask, s_mask_old, a_mask = -1;
     int pos = op->args[2];
     int len = op->args[3];
 
@@ -2502,18 +2502,16 @@  static bool fold_sextract(OptContext *ctx, TCGOp *op)
 
     z_mask = arg_info(op->args[1])->z_mask;
     z_mask = sextract64(z_mask, pos, len);
-    ctx->z_mask = z_mask;
 
     s_mask_old = arg_info(op->args[1])->s_mask;
     s_mask = sextract64(s_mask_old, pos, len);
     s_mask |= MAKE_64BIT_MASK(len, 64 - len);
-    ctx->s_mask = s_mask;
 
     if (pos == 0) {
-        ctx->a_mask = s_mask & ~s_mask_old;
+        a_mask = s_mask & ~s_mask_old;
     }
 
-    return fold_masks(ctx, op);
+    return fold_masks_zsa(ctx, op, z_mask, s_mask, a_mask);
 }
 
 static bool fold_shift(OptContext *ctx, TCGOp *op)