summary refs log tree commit diff stats
path: root/tcg/optimize.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2021-08-26 13:24:17 -0700
committerRichard Henderson <richard.henderson@linaro.org>2021-10-28 20:55:07 -0700
commit2b9d0c59edec097c72ce9b917d3c08dc5d59cdda (patch)
tree62721df48e0dac5a71fd1d4b2c565c42d6e0072c /tcg/optimize.c
parent275d7d8e70ef8679e241ce78c83548067f403394 (diff)
downloadfocaccia-qemu-2b9d0c59edec097c72ce9b917d3c08dc5d59cdda.tar.gz
focaccia-qemu-2b9d0c59edec097c72ce9b917d3c08dc5d59cdda.zip
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>
Diffstat (limited to 'tcg/optimize.c')
-rw-r--r--tcg/optimize.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 5fa4d7285d..c0eccc61d6 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1229,7 +1229,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;
 }
 
@@ -1249,6 +1249,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;
 }