aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2024-12-10 08:26:56 -0600
committerRichard Henderson <richard.henderson@linaro.org>2025-06-30 07:42:37 -0600
commit33fcebadd04ab420a485f864bda651b8b360472d (patch)
tree98145e8eb2b783cdd39ce187241fc3adf1a8f46d
parentd4d441e3a1c9f485a27662890ec7c009a056fda8 (diff)
downloadqemu-33fcebadd04ab420a485f864bda651b8b360472d.zip
qemu-33fcebadd04ab420a485f864bda651b8b360472d.tar.gz
qemu-33fcebadd04ab420a485f864bda651b8b360472d.tar.bz2
tcg/optimize: Build and use z_bits and o_bits in fold_eqv
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, 12 insertions, 2 deletions
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 123734b..6d35a2e 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1093,6 +1093,12 @@ static bool fold_masks_zosa(OptContext *ctx, TCGOp *op, uint64_t z_mask,
return true;
}
+static bool fold_masks_zos(OptContext *ctx, TCGOp *op,
+ uint64_t z_mask, uint64_t o_mask, uint64_t s_mask)
+{
+ return fold_masks_zosa(ctx, op, z_mask, o_mask, s_mask, -1);
+}
+
static bool fold_masks_zs(OptContext *ctx, TCGOp *op,
uint64_t z_mask, uint64_t s_mask)
{
@@ -1916,7 +1922,7 @@ static bool fold_dup2(OptContext *ctx, TCGOp *op)
static bool fold_eqv(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) ||
@@ -1946,8 +1952,12 @@ static bool fold_eqv(OptContext *ctx, TCGOp *op)
}
t1 = arg_info(op->args[1]);
+
+ z_mask = (t1->z_mask | ~t2->o_mask) & (t2->z_mask | ~t1->o_mask);
+ o_mask = ~(t1->z_mask | t2->z_mask) | (t1->o_mask & t2->o_mask);
s_mask = t1->s_mask & t2->s_mask;
- return fold_masks_s(ctx, op, s_mask);
+
+ return fold_masks_zos(ctx, op, z_mask, o_mask, s_mask);
}
static bool fold_extract(OptContext *ctx, TCGOp *op)