tcg/optimize: Propagate sign info for bit counting

The results are generally 6 bit unsigned values, though
the count leading and trailing bits may produce any value
for a zero input.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Luis Pires <luis.pires@eldorado.org.br>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2021-08-26 13:24:17 -07:00
parent 275d7d8e70
commit 2b9d0c59ed

View File

@ -1229,7 +1229,7 @@ static bool fold_count_zeros(OptContext *ctx, TCGOp *op)
g_assert_not_reached(); g_assert_not_reached();
} }
ctx->z_mask = arg_info(op->args[2])->z_mask | z_mask; ctx->z_mask = arg_info(op->args[2])->z_mask | z_mask;
ctx->s_mask = smask_from_zmask(ctx->z_mask);
return false; return false;
} }
@ -1249,6 +1249,7 @@ static bool fold_ctpop(OptContext *ctx, TCGOp *op)
default: default:
g_assert_not_reached(); g_assert_not_reached();
} }
ctx->s_mask = smask_from_zmask(ctx->z_mask);
return false; return false;
} }