aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2024-12-09 14:05:01 -0600
committerRichard Henderson <richard.henderson@linaro.org>2025-06-30 07:42:38 -0600
commite532a39352878c506966a0e4e19ee938fca194ec (patch)
tree2d2e2debb9b68ce336bf9c23547875a1ef99212d
parent03329e3ce4609d9d63f8786294eb724289f9b596 (diff)
downloadqemu-e532a39352878c506966a0e4e19ee938fca194ec.zip
qemu-e532a39352878c506966a0e4e19ee938fca194ec.tar.gz
qemu-e532a39352878c506966a0e4e19ee938fca194ec.tar.bz2
tcg/optimize: Use fold_and in do_constant_folding_cond[12]
When lowering tst comparisons, completely fold the and opcode that we generate. Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r--tcg/optimize.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 0b441bc..aa64f15 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -784,6 +784,7 @@ static bool swap_commutative2(TCGArg *p1, TCGArg *p2)
* Return -1 if the condition can't be simplified,
* and the result of the condition (0 or 1) if it can.
*/
+static bool fold_and(OptContext *ctx, TCGOp *op);
static int do_constant_folding_cond1(OptContext *ctx, TCGOp *op, TCGArg dest,
TCGArg *p1, TCGArg *p2, TCGArg *pcond)
{
@@ -834,6 +835,7 @@ static int do_constant_folding_cond1(OptContext *ctx, TCGOp *op, TCGArg dest,
op2->args[0] = tmp;
op2->args[1] = *p1;
op2->args[2] = *p2;
+ fold_and(ctx, op2);
*p1 = tmp;
*p2 = arg_new_constant(ctx, 0);
@@ -929,9 +931,12 @@ static int do_constant_folding_cond2(OptContext *ctx, TCGOp *op, TCGArg *args)
op1->args[0] = t1;
op1->args[1] = al;
op1->args[2] = bl;
+ fold_and(ctx, op1);
+
op2->args[0] = t2;
op2->args[1] = ah;
op2->args[2] = bh;
+ fold_and(ctx, op1);
args[0] = t1;
args[1] = t2;