aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2024-12-09 18:13:15 -0600
committerRichard Henderson <richard.henderson@linaro.org>2025-06-30 07:42:37 -0600
commit16559c3ecbacab16d471a4a6f5a35f14325c3fe4 (patch)
tree7602208ca51b57d812d1a8b4d8c46649cd46cc12
parent33fcebadd04ab420a485f864bda651b8b360472d (diff)
downloadqemu-16559c3ecbacab16d471a4a6f5a35f14325c3fe4.zip
qemu-16559c3ecbacab16d471a4a6f5a35f14325c3fe4.tar.gz
qemu-16559c3ecbacab16d471a4a6f5a35f14325c3fe4.tar.bz2
tcg/optimize: Build and use z_bits and o_bits in fold_nand
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r--tcg/optimize.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 6d35a2e..758f7b1 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -2197,16 +2197,22 @@ static bool fold_multiply2(OptContext *ctx, TCGOp *op)
static bool fold_nand(OptContext *ctx, TCGOp *op)
{
- uint64_t s_mask;
+ uint64_t z_mask, o_mask, s_mask;
+ TempOptInfo *t1, *t2;
if (fold_const2_commutative(ctx, op) ||
fold_xi_to_not(ctx, op, -1)) {
return true;
}
- s_mask = arg_info(op->args[1])->s_mask
- & arg_info(op->args[2])->s_mask;
- return fold_masks_s(ctx, op, s_mask);
+ t1 = arg_info(op->args[1]);
+ t2 = arg_info(op->args[2]);
+
+ z_mask = ~(t1->o_mask & t2->o_mask);
+ o_mask = ~(t1->z_mask & t2->z_mask);
+ s_mask = t1->s_mask & t2->s_mask;
+
+ return fold_masks_zos(ctx, op, z_mask, o_mask, s_mask);
}
static bool fold_neg_no_const(OptContext *ctx, TCGOp *op)