[PATCH v3 47/48] tcg/optimize: Propagate sign info for bit counting

Richard Henderson posted 48 patches 4 years, 3 months ago
Maintainers: Richard Henderson <richard.henderson@linaro.org>
There is a newer version of this series
[PATCH v3 47/48] tcg/optimize: Propagate sign info for bit counting
Posted by Richard Henderson 4 years, 3 months ago
The results are generally 6 bit unsigned values, though
the count leading and trailing bits may produce any value
for a zero input.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 tcg/optimize.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tcg/optimize.c b/tcg/optimize.c
index 64d3256bbc..3dd9219d69 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1215,7 +1215,7 @@ static bool fold_count_zeros(OptContext *ctx, TCGOp *op)
         g_assert_not_reached();
     }
     ctx->z_mask = arg_info(op->args[2])->z_mask | z_mask;
-
+    ctx->s_mask = smask_from_zmask(ctx->z_mask);
     return false;
 }
 
@@ -1235,6 +1235,7 @@ static bool fold_ctpop(OptContext *ctx, TCGOp *op)
     default:
         g_assert_not_reached();
     }
+    ctx->s_mask = smask_from_zmask(ctx->z_mask);
     return false;
 }
 
-- 
2.25.1


Re: [PATCH v3 47/48] tcg/optimize: Propagate sign info for bit counting
Posted by Alex Bennée 4 years, 3 months ago
Richard Henderson <richard.henderson@linaro.org> writes:

> The results are generally 6 bit unsigned values, though
> the count leading and trailing bits may produce any value
> for a zero input.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée