Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 260e3ea072..6d2d55f053 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1874,6 +1874,7 @@ static bool fold_mov(OptContext *ctx, TCGOp *op)
static bool fold_movcond(OptContext *ctx, TCGOp *op)
{
+ uint64_t z_mask, s_mask;
int i;
/* If true and false values are the same, eliminate the cmp. */
@@ -1895,10 +1896,10 @@ static bool fold_movcond(OptContext *ctx, TCGOp *op)
return tcg_opt_gen_mov(ctx, op, op->args[0], op->args[4 - i]);
}
- ctx->z_mask = arg_info(op->args[3])->z_mask
- | arg_info(op->args[4])->z_mask;
- ctx->s_mask = arg_info(op->args[3])->s_mask
- & arg_info(op->args[4])->s_mask;
+ z_mask = arg_info(op->args[3])->z_mask
+ | arg_info(op->args[4])->z_mask;
+ s_mask = arg_info(op->args[3])->s_mask
+ & arg_info(op->args[4])->s_mask;
if (arg_is_const(op->args[3]) && arg_is_const(op->args[4])) {
uint64_t tv = arg_info(op->args[3])->val;
@@ -1941,7 +1942,7 @@ static bool fold_movcond(OptContext *ctx, TCGOp *op)
}
}
}
- return false;
+ return fold_masks_zs(ctx, op, z_mask, s_mask);
}
static bool fold_mul(OptContext *ctx, TCGOp *op)