diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2024-12-08 21:09:30 -0600 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2024-12-24 08:32:15 -0800 |
commit | baff507e50fbcb270a1a7b448c2cc37cc7f9ec05 (patch) | |
tree | 59317e9f0f50606c50d9c7ab73b9000c47b6161b | |
parent | 210c70b7ac449f2eabc55893eca15fe36d36391f (diff) | |
download | qemu-baff507e50fbcb270a1a7b448c2cc37cc7f9ec05.zip qemu-baff507e50fbcb270a1a7b448c2cc37cc7f9ec05.tar.gz qemu-baff507e50fbcb270a1a7b448c2cc37cc7f9ec05.tar.bz2 |
tcg/optimize: Use fold_masks_zs in fold_sextract
Avoid the use of the OptContext slots. Find TempOptInfo once.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r-- | tcg/optimize.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/tcg/optimize.c b/tcg/optimize.c index 4090ffe..2d634c89 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2507,31 +2507,25 @@ static bool fold_cmpsel_vec(OptContext *ctx, TCGOp *op) static bool fold_sextract(OptContext *ctx, TCGOp *op) { uint64_t z_mask, s_mask, s_mask_old; + TempOptInfo *t1 = arg_info(op->args[1]); int pos = op->args[2]; int len = op->args[3]; - if (arg_is_const(op->args[1])) { - uint64_t t; - - t = arg_info(op->args[1])->val; - t = sextract64(t, pos, len); - return tcg_opt_gen_movi(ctx, op, op->args[0], t); + if (ti_is_const(t1)) { + return tcg_opt_gen_movi(ctx, op, op->args[0], + sextract64(ti_const_val(t1), pos, len)); } - z_mask = arg_info(op->args[1])->z_mask; - z_mask = sextract64(z_mask, pos, len); - ctx->z_mask = z_mask; - - s_mask_old = arg_info(op->args[1])->s_mask; - s_mask = sextract64(s_mask_old, pos, len); - s_mask |= MAKE_64BIT_MASK(len, 64 - len); - ctx->s_mask = s_mask; + s_mask_old = t1->s_mask; + s_mask = s_mask_old >> pos; + s_mask |= -1ull << (len - 1); if (0 && pos == 0 && fold_affected_mask(ctx, op, s_mask & ~s_mask_old)) { return true; } - return fold_masks(ctx, op); + z_mask = sextract64(t1->z_mask, pos, len); + return fold_masks_zs(ctx, op, z_mask, s_mask); } static bool fold_shift(OptContext *ctx, TCGOp *op) |