diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2024-12-19 10:43:26 -0800 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2024-12-24 07:32:50 -0800 |
commit | d582b14d808ee9b9c624140a1d253b6381406a9e (patch) | |
tree | 9db2a72666711d96ac53b3b9e054cc0a92aff02a /tcg | |
parent | 56e06ecfa5f13816b68b850f4ce46d8756e2c32b (diff) | |
download | qemu-d582b14d808ee9b9c624140a1d253b6381406a9e.zip qemu-d582b14d808ee9b9c624140a1d253b6381406a9e.tar.gz qemu-d582b14d808ee9b9c624140a1d253b6381406a9e.tar.bz2 |
tcg/optimize: Split out fold_masks_zs
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>
Diffstat (limited to 'tcg')
-rw-r--r-- | tcg/optimize.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tcg/optimize.c b/tcg/optimize.c index 2aa57af..d70127b 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 |