From: Richard Henderson Date: Tue, 10 Dec 2024 04:22:27 +0000 (-0600) Subject: tcg/optimize: Build and use zero, one and affected bits in fold_orc X-Git-Tag: v10.1.0-rc0~39^2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc4033ee47c39ca5668ca0ab9b23046cf029fc21;p=thirdparty%2Fqemu.git tcg/optimize: Build and use zero, one and affected bits in fold_orc Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- diff --git a/tcg/optimize.c b/tcg/optimize.c index ce065d0e224..795f1c900ef 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2287,7 +2287,7 @@ static bool fold_or(OptContext *ctx, TCGOp *op) static bool fold_orc(OptContext *ctx, TCGOp *op) { - uint64_t s_mask; + uint64_t z_mask, o_mask, s_mask, a_mask; TempOptInfo *t1, *t2; if (fold_const2(ctx, op) || @@ -2318,8 +2318,15 @@ static bool fold_orc(OptContext *ctx, TCGOp *op) } t1 = arg_info(op->args[1]); + + z_mask = t1->z_mask | ~t2->o_mask; + o_mask = t1->o_mask | ~t2->z_mask; s_mask = t1->s_mask & t2->s_mask; - return fold_masks_s(ctx, op, s_mask); + + /* Affected bits are those not known one, masked by those known one. */ + a_mask = ~t1->o_mask & t2->o_mask; + + return fold_masks_zosa(ctx, op, z_mask, o_mask, s_mask, a_mask); } static bool fold_qemu_ld_1reg(OptContext *ctx, TCGOp *op)