aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2024-12-10 08:14:35 -0600
committerRichard Henderson <richard.henderson@linaro.org>2025-06-30 07:42:38 -0600
commit61617f715ec26877cdda9e027ac43945910f4fe9 (patch)
treebf9dfef1e75f0cf1192f80e3fda41426f12192d0
parent3c75cb4d64811cfba2c03d66328d838cc72f8355 (diff)
downloadqemu-61617f715ec26877cdda9e027ac43945910f4fe9.zip
qemu-61617f715ec26877cdda9e027ac43945910f4fe9.tar.gz
qemu-61617f715ec26877cdda9e027ac43945910f4fe9.tar.bz2
tcg/optimize: Simplify fold_orc constant checks
If operand 2 is constant, then the computation of z_mask and a_mask will produce the same results as the explicit check via fold_xi_to_i. Shift the calls of fold_xx_to_i and fold_ix_to_not down below the i2->is_const check. Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r--tcg/optimize.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 8d14a38..a48ddd9 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -2326,10 +2326,7 @@ static bool fold_orc(OptContext *ctx, TCGOp *op)
uint64_t z_mask, o_mask, s_mask, a_mask;
TempOptInfo *t1, *t2;
- if (fold_const2(ctx, op) ||
- fold_xx_to_i(ctx, op, -1) ||
- fold_xi_to_x(ctx, op, -1) ||
- fold_ix_to_not(ctx, op, 0)) {
+ if (fold_const2(ctx, op)) {
return true;
}
@@ -2352,7 +2349,10 @@ static bool fold_orc(OptContext *ctx, TCGOp *op)
op->args[2] = arg_new_constant(ctx, ~ti_const_val(t2));
return fold_or(ctx, op);
}
-
+ if (fold_xx_to_i(ctx, op, -1) ||
+ fold_ix_to_not(ctx, op, 0)) {
+ return true;
+ }
t1 = arg_info(op->args[1]);
z_mask = t1->z_mask | ~t2->o_mask;