[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 13/23] target/loongarch: Fix rdtimer on 32bit build
From: |
Jiaxun Yang |
Subject: |
[PATCH v2 13/23] target/loongarch: Fix rdtimer on 32bit build |
Date: |
Thu, 26 Dec 2024 21:19:44 +0000 |
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);
}
- tcg_gen_ld_i64(dst2, tcg_env, offsetof(CPULoongArchState, CSR_TID));
+ tcg_gen_ld_tl(dst2, tcg_env, offsetof(CPULoongArchState, CSR_TID));
return true;
}
--
2.43.0
- Re: [PATCH v2 09/23] target/loongarch: Use target_ulong for CSR helpers, (continued)
- [PATCH v2 13/23] target/loongarch: Fix rdtimer on 32bit build,
Jiaxun Yang <=
- [PATCH v2 14/23] target/loongarch: Scrutinise TCG arithmetic translation for 32 bit build, Jiaxun Yang, 2024/12/26
- [PATCH v2 15/23] target/loongarch: Fix load type for gen_ll, Jiaxun Yang, 2024/12/26
- [PATCH v2 16/23] target/loongarch: Define address space information for LoongArch32, Jiaxun Yang, 2024/12/26
- [PATCH v2 17/23] target/loongarch: Refactoring is_la64/is_va32 for LoongArch32, Jiaxun Yang, 2024/12/26
- [PATCH v2 18/23] target/loongarch: ifdef out 64 bit CPUs on 32 bit builds, Jiaxun Yang, 2024/12/26
- [PATCH v2 19/23] target/loongarch: Introduce max32 CPU type, Jiaxun Yang, 2024/12/26