Message ID | 20241210152401.1823648-16-richard.henderson@linaro.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | tcg: Remove in-flight mask data from OptContext | expand |
On 12/10/24 07:23, Richard Henderson wrote: > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> > --- > tcg/optimize.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/tcg/optimize.c b/tcg/optimize.c > index 5f3a824a07..955151f4cf 100644 > --- a/tcg/optimize.c > +++ b/tcg/optimize.c > @@ -1716,7 +1716,7 @@ static bool fold_eqv(OptContext *ctx, TCGOp *op) > > static bool fold_extract(OptContext *ctx, TCGOp *op) > { > - uint64_t z_mask_old, z_mask; > + uint64_t z_mask_old, z_mask, s_mask, a_mask = -1; > int pos = op->args[2]; > int len = op->args[3]; > > @@ -1731,12 +1731,11 @@ static bool fold_extract(OptContext *ctx, TCGOp *op) > z_mask_old = arg_info(op->args[1])->z_mask; > z_mask = extract64(z_mask_old, pos, len); > if (pos == 0) { > - ctx->a_mask = z_mask_old ^ z_mask; > + a_mask = z_mask_old ^ z_mask; > } > - ctx->z_mask = z_mask; > - ctx->s_mask = smask_from_zmask(z_mask); > + s_mask = smask_from_zmask(z_mask); > > - return fold_masks(ctx, op); > + return fold_masks_zsa(ctx, op, z_mask, s_mask, a_mask); > } In this case, we could have a fold_masks_za function. Sometimes, we put special values for one flag, or sometimes we call smask_from_zmask, or we rely on the implicit behaviour of the fold_masks_* variant, so this makes it a bit hard to follow. Either we should go fully explicit (only fold_masks, with the three masks, and every call site has to mention them), or specialized functions for every situation we need to support. But a mix in the middle feels a bit awkward. > > static bool fold_extract2(OptContext *ctx, TCGOp *op) Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
diff --git a/tcg/optimize.c b/tcg/optimize.c index 5f3a824a07..955151f4cf 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1716,7 +1716,7 @@ static bool fold_eqv(OptContext *ctx, TCGOp *op) static bool fold_extract(OptContext *ctx, TCGOp *op) { - uint64_t z_mask_old, z_mask; + uint64_t z_mask_old, z_mask, s_mask, a_mask = -1; int pos = op->args[2]; int len = op->args[3]; @@ -1731,12 +1731,11 @@ static bool fold_extract(OptContext *ctx, TCGOp *op) z_mask_old = arg_info(op->args[1])->z_mask; z_mask = extract64(z_mask_old, pos, len); if (pos == 0) { - ctx->a_mask = z_mask_old ^ z_mask; + a_mask = z_mask_old ^ z_mask; } - ctx->z_mask = z_mask; - ctx->s_mask = smask_from_zmask(z_mask); + s_mask = smask_from_zmask(z_mask); - return fold_masks(ctx, op); + return fold_masks_zsa(ctx, op, z_mask, s_mask, a_mask); } static bool fold_extract2(OptContext *ctx, TCGOp *op)
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- tcg/optimize.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)