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);
}