diff mbox series

[22/46] tcg/optimize: Use fold_masks_z in fold_neg_no_const

Message ID 20241210152401.1823648-23-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, 2 insertions(+), 7 deletions(-)

Comments

Pierrick Bouvier Dec. 17, 2024, 8:28 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, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/tcg/optimize.c b/tcg/optimize.c
> index 924ee165ba..cc3dc91d3f 100644
> --- a/tcg/optimize.c
> +++ b/tcg/optimize.c
> @@ -2027,14 +2027,9 @@ static bool fold_neg_no_const(OptContext *ctx, TCGOp *op)
>   {
>       /* Set to 1 all bits to the left of the rightmost.  */
>       uint64_t z_mask = arg_info(op->args[1])->z_mask;
> -    ctx->z_mask = -(z_mask & -z_mask);
> +    z_mask = -(z_mask & -z_mask);
>   
> -    /*
> -     * Because of fold_sub_to_neg, we want to always return true,
> -     * via finish_folding.
> -     */
> -    finish_folding(ctx, op);
> -    return true;
> +    return fold_masks_z(ctx, op, z_mask);
>   }
>   
>   static bool fold_neg(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 924ee165ba..cc3dc91d3f 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -2027,14 +2027,9 @@  static bool fold_neg_no_const(OptContext *ctx, TCGOp *op)
 {
     /* Set to 1 all bits to the left of the rightmost.  */
     uint64_t z_mask = arg_info(op->args[1])->z_mask;
-    ctx->z_mask = -(z_mask & -z_mask);
+    z_mask = -(z_mask & -z_mask);
 
-    /*
-     * Because of fold_sub_to_neg, we want to always return true,
-     * via finish_folding.
-     */
-    finish_folding(ctx, op);
-    return true;
+    return fold_masks_z(ctx, op, z_mask);
 }
 
 static bool fold_neg(OptContext *ctx, TCGOp *op)