[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 06/72] tcg/optimize: Split out fold_masks_zs
From: |
Richard Henderson |
Subject: |
[PULL 06/72] tcg/optimize: Split out fold_masks_zs |
Date: |
Tue, 24 Dec 2024 12:04:15 -0800 |
Add a routine to which masks can be passed directly, rather than
storing them into OptContext. To be used in upcoming patches.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 2aa57afd64..d70127b88d 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1044,10 +1044,14 @@ static bool fold_const2_commutative(OptContext *ctx,
TCGOp *op)
return fold_const2(ctx, op);
}
-static bool fold_masks(OptContext *ctx, TCGOp *op)
+/*
+ * Record "zero" and "sign" masks for the single output of @op.
+ * See TempOptInfo definition of z_mask and s_mask.
+ * If z_mask allows, fold the output to constant zero.
+ */
+static bool fold_masks_zs(OptContext *ctx, TCGOp *op,
+ uint64_t z_mask, uint64_t s_mask)
{
- uint64_t z_mask = ctx->z_mask;
- uint64_t s_mask = ctx->s_mask;
const TCGOpDef *def = &tcg_op_defs[op->opc];
TCGTemp *ts;
TempOptInfo *ti;
@@ -1080,6 +1084,11 @@ static bool fold_masks(OptContext *ctx, TCGOp *op)
return true;
}
+static bool fold_masks(OptContext *ctx, TCGOp *op)
+{
+ return fold_masks_zs(ctx, op, ctx->z_mask, ctx->s_mask);
+}
+
/*
* An "affected" mask bit is 0 if and only if the result is identical
* to the first input. Thus if the entire mask is 0, the operation
--
2.43.0
- [PULL 00/72] tcg patch queue, Richard Henderson, 2024/12/24
- [PULL 01/72] tests/tcg: Do not use inttypes.h in multiarch/system/memory.c, Richard Henderson, 2024/12/24
- [PULL 04/72] tcg/optimize: Split out fold_affected_mask, Richard Henderson, 2024/12/24
- [PULL 07/72] tcg/optimize: Augment s_mask from z_mask in fold_masks_zs, Richard Henderson, 2024/12/24
- [PULL 09/72] tcg/optimize: Use finish_folding in fold_add, fold_add_vec, fold_addsub2, Richard Henderson, 2024/12/24
- [PULL 10/72] tcg/optimize: Introduce const value accessors for TempOptInfo, Richard Henderson, 2024/12/24
- [PULL 06/72] tcg/optimize: Split out fold_masks_zs,
Richard Henderson <=
- [PULL 12/72] tcg/optimize: Use fold_masks_zs in fold_andc, Richard Henderson, 2024/12/24
- [PULL 14/72] tcg/optimize: Use fold_masks_zs in fold_count_zeros, Richard Henderson, 2024/12/24
- [PULL 16/72] tcg/optimize: Use fold_and and fold_masks_z in fold_deposit, Richard Henderson, 2024/12/24
- [PULL 19/72] tcg/optimize: Use finish_folding in fold_dup, fold_dup2, Richard Henderson, 2024/12/24
- [PULL 25/72] tcg/optimize: Use fold_masks_zs in fold_movcond, Richard Henderson, 2024/12/24
- [PULL 03/72] tcg/optimize: Split out finish_bb, finish_ebb, Richard Henderson, 2024/12/24
- [PULL 08/72] tcg/optimize: Change representation of s_mask, Richard Henderson, 2024/12/24
- [PULL 05/72] tcg/optimize: Copy mask writeback to fold_masks, Richard Henderson, 2024/12/24
- [PULL 13/72] tcg/optimize: Use fold_masks_zs in fold_bswap, Richard Henderson, 2024/12/24
- [PULL 15/72] tcg/optimize: Use fold_masks_z in fold_ctpop, Richard Henderson, 2024/12/24