qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tcg/optimize: Fix constant folding of setcond


From: Richard Henderson
Subject: Re: [PATCH] tcg/optimize: Fix constant folding of setcond
Date: Sat, 7 Dec 2024 12:27:34 -0600
User-agent: Mozilla Thunderbird

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~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]