From: Richard Henderson <richard.henderson@linaro.org>
To: wannacu <wannacu2049@gmail.com>, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Eduardo Habkost <eduardo@habkost.net>
Subject: Re: [PATCH] tcg/optimize: Fix constant folding of setcond
Date: Sat, 7 Dec 2024 12:27:34 -0600 [thread overview]
Message-ID: <7f8d7f1b-8c5d-42de-8d5c-137b2d281719@linaro.org> (raw)
In-Reply-To: <20241206095824.281216-1-wannacu2049@gmail.com>
On 12/6/24 03:58, wannacu wrote:
> The `z_mask` field of TCGTemp argument needs to be
> properly set for the upcoming `fold_setcond_zmask` call
>
> This patch resolves issues with running some x86_64
> applications (e.g., FontForge, Krita) on riscv64
>
> Signed-off-by: wannacu <wannacu2049@gmail.com>
> ---
> tcg/optimize.c | 3 +++
> tests/tcg/x86_64/Makefile.target | 1 +
> tests/tcg/x86_64/setcond.c | 28 ++++++++++++++++++++++++++++
> 3 files changed, 32 insertions(+)
> create mode 100644 tests/tcg/x86_64/setcond.c
>
> diff --git a/tcg/optimize.c b/tcg/optimize.c
> index e9ef16b3c6..e580b8d8b1 100644
> --- a/tcg/optimize.c
> +++ b/tcg/optimize.c
> @@ -834,6 +834,9 @@ static int do_constant_folding_cond1(OptContext *ctx, TCGOp *op, TCGArg dest,
> ? INDEX_op_and_i32 : INDEX_op_and_i64);
> TCGOp *op2 = tcg_op_insert_before(ctx->tcg, op, and_opc, 3);
> TCGArg tmp = arg_new_temp(ctx);
> + /* Set z_mask for the follwing `fold_setcond_zmask` call. */
> + arg_info(tmp)->z_mask = (ctx->type == TCG_TYPE_I32
> + ? UINT32_MAX : UINT64_MAX);
I was curious as to why this helped, when arg_new_temp was supposed to be doing exactly
this. It turns out we were incorrectly reusing an old temp, not allocating a new one.
r~
next prev parent reply other threads:[~2024-12-07 18:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-06 9:58 [PATCH] tcg/optimize: Fix constant folding of setcond wannacu
2024-12-06 15:41 ` Richard Henderson
2024-12-07 8:29 ` wannacu
2024-12-07 18:27 ` Richard Henderson [this message]
2024-12-09 1:46 ` wannacu
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=7f8d7f1b-8c5d-42de-8d5c-137b2d281719@linaro.org \
--to=richard.henderson@linaro.org \
--cc=eduardo@habkost.net \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=wannacu2049@gmail.com \
/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).