[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 37/46] tcg/optimize: Use fold_masks_zs in fold_shift
From: |
Richard Henderson |
Subject: |
[PATCH 37/46] tcg/optimize: Use fold_masks_zs in fold_shift |
Date: |
Tue, 10 Dec 2024 09:23:52 -0600 |
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 551f96dfaa..bec5a07288 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -2530,12 +2530,12 @@ static bool fold_shift(OptContext *ctx, TCGOp *op)
if (arg_is_const(op->args[2])) {
int sh = arg_info(op->args[2])->val;
- ctx->z_mask = do_constant_folding(op->opc, ctx->type, z_mask, sh);
+ z_mask = do_constant_folding(op->opc, ctx->type, z_mask, sh);
s_mask = do_constant_folding(op->opc, ctx->type, s_mask, sh);
- ctx->s_mask = smask_from_smask(s_mask);
+ s_mask = smask_from_smask(s_mask);
- return fold_masks(ctx, op);
+ return fold_masks_zs(ctx, op, z_mask, s_mask);
}
switch (op->opc) {
@@ -2544,23 +2544,22 @@ static bool fold_shift(OptContext *ctx, TCGOp *op)
* Arithmetic right shift will not reduce the number of
* input sign repetitions.
*/
- ctx->s_mask = s_mask;
- break;
+ return fold_masks_zs(ctx, op, -1, s_mask);
CASE_OP_32_64(shr):
/*
* If the sign bit is known zero, then logical right shift
- * will not reduced the number of input sign repetitions.
+ * will not reduce the number of input sign repetitions.
*/
sign = (s_mask & -s_mask) >> 1;
if (sign && !(z_mask & sign)) {
- ctx->s_mask = s_mask;
+ return fold_masks_zs(ctx, op, -1, s_mask);
}
break;
default:
break;
}
- return false;
+ return finish_folding(ctx, op);
}
static bool fold_sub_to_neg(OptContext *ctx, TCGOp *op)
--
2.43.0
- Re: [PATCH 31/46] tcg/optimize: Use fold_masks_z in fold_setcond, (continued)
- [PATCH 38/46] tcg/optimize: Use finish_folding in fold_sub, fold_sub_vec, Richard Henderson, 2024/12/10
- [PATCH 35/46] tcg/optimize: Use finish_folding in fold_cmpsel_vec, Richard Henderson, 2024/12/10
- [PATCH 36/46] tcg/optimize: Use fold_masks_zsa in fold_sextract, Richard Henderson, 2024/12/10
- [PATCH 34/46] tcg/optimize: Use finish_folding in fold_cmp_vec, Richard Henderson, 2024/12/10
- [PATCH 37/46] tcg/optimize: Use fold_masks_zs in fold_shift,
Richard Henderson <=
- [PATCH 39/46] tcg/optimize: Use fold_masks_zs in fold_tcg_ld, Richard Henderson, 2024/12/10
- [PATCH 41/46] tcg/optimize: Use fold_masks_zs in fold_xor, Richard Henderson, 2024/12/10
- [PATCH 42/46] tcg/optimize: Use finish_folding in fold_bitsel_vec, Richard Henderson, 2024/12/10
- [PATCH 40/46] tcg/optimize: Use finish_folding in fold_tcg_ld_memcopy, Richard Henderson, 2024/12/10