qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2 13/23] target/loongarch: Fix rdtimer on 32bit build


From: Richard Henderson
Subject: Re: [PATCH v2 13/23] target/loongarch: Fix rdtimer on 32bit build
Date: Thu, 26 Dec 2024 14:16:50 -0800
User-agent: Mozilla Thunderbird

On 12/26/24 13:19, Jiaxun Yang wrote:
Use TCGv_i64 for intermediate values and perform truncation as necessary.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
  target/loongarch/tcg/insn_trans/trans_extra.c.inc | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/target/loongarch/tcg/insn_trans/trans_extra.c.inc 
b/target/loongarch/tcg/insn_trans/trans_extra.c.inc
index 
cfa361fecfa9ba569034b2c591b910ae7a3c6427..f9fb828ce51f2ee925edde7330d3054da534ecb3
 100644
--- a/target/loongarch/tcg/insn_trans/trans_extra.c.inc
+++ b/target/loongarch/tcg/insn_trans/trans_extra.c.inc
@@ -46,13 +46,15 @@ static bool gen_rdtime(DisasContext *ctx, arg_rr *a,
  {
      TCGv dst1 = gpr_dst(ctx, a->rd, EXT_NONE);
      TCGv dst2 = gpr_dst(ctx, a->rj, EXT_NONE);
+    TCGv_i64 val = tcg_temp_new_i64();
translator_io_start(&ctx->base);
-    gen_helper_rdtime_d(dst1, tcg_env);
+    gen_helper_rdtime_d(val, tcg_env);
      if (word) {
-        tcg_gen_sextract_tl(dst1, dst1, high ? 32 : 0, 32);
+        tcg_gen_sextract_i64(val, val, high ? 32 : 0, 32);
+        tcg_gen_trunc_i64_tl(dst1, val);
      }

If !word, you are no longer assigning to dst1.
The trunc must be moved below if (word).


r~



reply via email to

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