aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2024-12-10 08:39:56 -0600
committerRichard Henderson <richard.henderson@linaro.org>2025-06-30 07:42:37 -0600
commit787190e3f433022d6fd2983f5e5efdb848439a41 (patch)
treec8cea7a76252cde9d2a164e4f18e5573df7c5e5c
parentcc4033ee47c39ca5668ca0ab9b23046cf029fc21 (diff)
downloadqemu-787190e3f433022d6fd2983f5e5efdb848439a41.zip
qemu-787190e3f433022d6fd2983f5e5efdb848439a41.tar.gz
qemu-787190e3f433022d6fd2983f5e5efdb848439a41.tar.bz2
tcg/optimize: Build and use o_bits in fold_xor
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r--tcg/optimize.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 795f1c9..572d314 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -3039,7 +3039,7 @@ static bool fold_tcg_st_memcopy(OptContext *ctx, TCGOp *op)
static bool fold_xor(OptContext *ctx, TCGOp *op)
{
- uint64_t z_mask, s_mask;
+ uint64_t z_mask, o_mask, s_mask;
TempOptInfo *t1, *t2;
if (fold_const2_commutative(ctx, op) ||
@@ -3051,9 +3051,12 @@ static bool fold_xor(OptContext *ctx, TCGOp *op)
t1 = arg_info(op->args[1]);
t2 = arg_info(op->args[2]);
- z_mask = t1->z_mask | t2->z_mask;
+
+ z_mask = (t1->z_mask | t2->z_mask) & ~(t1->o_mask & t2->o_mask);
+ o_mask = (t1->o_mask & ~t2->z_mask) | (t2->o_mask & ~t1->z_mask);
s_mask = t1->s_mask & t2->s_mask;
- return fold_masks_zs(ctx, op, z_mask, s_mask);
+
+ return fold_masks_zos(ctx, op, z_mask, o_mask, s_mask);
}
/* Propagate constants and copies, fold constant expressions. */