tcg/optimize: Build and use z_bits and o_bits in fold_nor

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2024-12-09 21:13:02 -06:00
parent 16559c3ecb
commit 682d6d57ba

View file

@ -2231,16 +2231,22 @@ static bool fold_neg(OptContext *ctx, TCGOp *op)
static bool fold_nor(OptContext *ctx, TCGOp *op)
{
uint64_t s_mask;
uint64_t z_mask, o_mask, s_mask;
TempOptInfo *t1, *t2;
if (fold_const2_commutative(ctx, op) ||
fold_xi_to_not(ctx, op, 0)) {
return true;
}
s_mask = arg_info(op->args[1])->s_mask
& arg_info(op->args[2])->s_mask;
return fold_masks_s(ctx, op, s_mask);
t1 = arg_info(op->args[1]);
t2 = arg_info(op->args[2]);
z_mask = ~(t1->o_mask | t2->o_mask);
o_mask = ~(t1->z_mask | t2->z_mask);
s_mask = t1->s_mask & t2->s_mask;
return fold_masks_zos(ctx, op, z_mask, o_mask, s_mask);
}
static bool fold_not(OptContext *ctx, TCGOp *op)