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)