[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 03/51] tcg/optimize: Copy mask writeback to fold_masks
From: |
Richard Henderson |
Subject: |
[PATCH v3 03/51] tcg/optimize: Copy mask writeback to fold_masks |
Date: |
Sun, 22 Dec 2024 08:23:58 -0800 |
Use of fold_masks should be restricted to those opcodes that
can reliably make use of it -- those with a single output,
and from higher-level folders that set up the masks.
Prepare for conversion of each folder in turn.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 6757fe0036..2aa57afd64 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1048,6 +1048,12 @@ static bool fold_masks(OptContext *ctx, TCGOp *op)
{
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;
+
+ /* Only single-output opcodes are supported here. */
+ tcg_debug_assert(def->nb_oargs == 1);
/*
* 32-bit ops generate 32-bit results, which for the purpose of
@@ -1059,14 +1065,19 @@ static bool fold_masks(OptContext *ctx, TCGOp *op)
if (ctx->type == TCG_TYPE_I32) {
z_mask = (int32_t)z_mask;
s_mask |= MAKE_64BIT_MASK(32, 32);
- ctx->z_mask = z_mask;
- ctx->s_mask = s_mask;
}
if (z_mask == 0) {
return tcg_opt_gen_movi(ctx, op, op->args[0], 0);
}
- return false;
+
+ ts = arg_temp(op->args[0]);
+ reset_ts(ctx, ts);
+
+ ti = ts_info(ts);
+ ti->z_mask = z_mask;
+ ti->s_mask = s_mask;
+ return true;
}
/*
--
2.43.0
- [PATCH v3 00/51] tcg: Remove in-flight mask data from OptContext, Richard Henderson, 2024/12/22
- [PATCH v3 03/51] tcg/optimize: Copy mask writeback to fold_masks,
Richard Henderson <=
- [PATCH v3 14/51] tcg/optimize: Compute sign mask in fold_deposit, Richard Henderson, 2024/12/22
- [PATCH v3 01/51] tcg/optimize: Split out finish_bb, finish_ebb, Richard Henderson, 2024/12/22
- [PATCH v3 02/51] tcg/optimize: Split out fold_affected_mask, Richard Henderson, 2024/12/22
- [PATCH v3 13/51] tcg/optimize: Use fold_and and fold_masks_z in fold_deposit, Richard Henderson, 2024/12/22
- [PATCH v3 24/51] tcg/optimize: Use fold_masks_s in fold_nand, Richard Henderson, 2024/12/22
- [PATCH v3 26/51] tcg/optimize: Use fold_masks_s in fold_nor, Richard Henderson, 2024/12/22
- [PATCH v3 30/51] tcg/optimize: Use fold_masks_zs in fold_qemu_ld, Richard Henderson, 2024/12/22
- [PATCH v3 05/51] tcg/optimize: Augment s_mask from z_mask in fold_masks_zs, Richard Henderson, 2024/12/22
- [PATCH v3 08/51] tcg/optimize: Use fold_masks_zs in fold_and, Richard Henderson, 2024/12/22
- [PATCH v3 19/51] tcg/optimize: Use finish_folding in fold_extract2, Richard Henderson, 2024/12/22