From: Richard Henderson <richard.henderson@linaro.org>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH for 10.0] tcg/optimize: fold recursively after optimizing deposit
Date: Thu, 21 Nov 2024 20:45:07 -0600 [thread overview]
Message-ID: <c852f180-48ea-489d-a32b-61f7b4123ac6@linaro.org> (raw)
In-Reply-To: <20241121081909.227610-1-pbonzini@redhat.com>
On 11/21/24 02:19, Paolo Bonzini wrote:
> When generating code for x86 targets, this is able to simplify XOR+SETcc
> sequences. SETcc generates a setcond+deposit pair of TCG opcodes which
> used to become setcond+ext32u after optimization; now TCG recognizes
> that the output of setcond is itself already zero extended and turns
> the deposit into just a mov.
>
> There are similar cases in fold_movcond and fold_setcond_zmask, but I couldn't
> trigger them and they require moving around functions to avoid forward
> references[1], so I am leaving them aside for now.
>
> [1] I assume the lack of forward references is intentional in order to
> avoid possible mutual recursion
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> tcg/optimize.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
As far as this goes, it's certainly correct. See also
https://lore.kernel.org/qemu-devel/20240312143839.136408-1-richard.henderson@linaro.org/
which I failed to pick up after the 9.0 release. :-/
r~
>
> diff --git a/tcg/optimize.c b/tcg/optimize.c
> index e9ef16b3c6b..e0fdaeb5500 100644
> --- a/tcg/optimize.c
> +++ b/tcg/optimize.c
> @@ -1620,7 +1620,7 @@ static bool fold_deposit(OptContext *ctx, TCGOp *op)
> op->args[1] = op->args[2];
> op->args[2] = arg_new_constant(ctx, mask);
> ctx->z_mask = mask & arg_info(op->args[1])->z_mask;
> - return false;
> + return fold_and(ctx, op);
> }
>
> /* Inserting zero into a value. */
> @@ -1630,7 +1630,7 @@ static bool fold_deposit(OptContext *ctx, TCGOp *op)
> op->opc = and_opc;
> op->args[2] = arg_new_constant(ctx, mask);
> ctx->z_mask = mask & arg_info(op->args[1])->z_mask;
> - return false;
> + return fold_and(ctx, op);
> }
>
> ctx->z_mask = deposit64(arg_info(op->args[1])->z_mask,
prev parent reply other threads:[~2024-11-22 2:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-21 8:19 [PATCH for 10.0] tcg/optimize: fold recursively after optimizing deposit Paolo Bonzini
2024-11-22 2:45 ` Richard Henderson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c852f180-48ea-489d-a32b-61f7b4123ac6@linaro.org \
--to=richard.henderson@linaro.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).