[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/5] target/riscv: Use sign-extended data address when xl = 32
From: |
Weiwei Li |
Subject: |
[PATCH 2/5] target/riscv: Use sign-extended data address when xl = 32 |
Date: |
Mon, 27 Mar 2023 18:00:24 +0800 |
Currently, the pc use signed-extend(in gen_set_pc*) when xl = 32. And
data address should use the same memory address space with it when
xl = 32. So we should change their address calculation to use sign-extended
address when xl = 32.
Signed-off-by: Weiwei Li <liweiwei@iscas.ac.cn>
Signed-off-by: Junqiang Wang <wangjunqiang@iscas.ac.cn>
---
target/riscv/translate.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/riscv/translate.c b/target/riscv/translate.c
index bf0e2d318e..c48cb19389 100644
--- a/target/riscv/translate.c
+++ b/target/riscv/translate.c
@@ -570,7 +570,7 @@ static TCGv get_address(DisasContext *ctx, int rs1, int imm)
tcg_gen_addi_tl(addr, src1, imm);
if (get_xl(ctx) == MXL_RV32) {
- tcg_gen_ext32u_tl(addr, addr);
+ tcg_gen_ext32s_tl(addr, addr);
}
if (ctx->pm_mask_enabled) {
@@ -592,7 +592,7 @@ static TCGv get_address_indexed(DisasContext *ctx, int rs1,
TCGv offs)
tcg_gen_add_tl(addr, src1, offs);
if (get_xl(ctx) == MXL_RV32) {
- tcg_gen_ext32u_tl(addr, addr);
+ tcg_gen_ext32s_tl(addr, addr);
}
if (ctx->pm_mask_enabled) {
--
2.25.1
- Re: [PATCH 3/5] target/riscv: Fix pointer mask transformation for vector address, (continued)
- [PATCH 1/5] target/riscv: Fix effective address for pointer mask, Weiwei Li, 2023/03/27
- Re: [PATCH 1/5] target/riscv: Fix effective address for pointer mask, Daniel Henrique Barboza, 2023/03/27
- Re: [PATCH 1/5] target/riscv: Fix effective address for pointer mask, LIU Zhiwei, 2023/03/27
- Re: [PATCH 1/5] target/riscv: Fix effective address for pointer mask, liweiwei, 2023/03/27
- Re: [PATCH 1/5] target/riscv: Fix effective address for pointer mask, Richard Henderson, 2023/03/27
- Re: [PATCH 1/5] target/riscv: Fix effective address for pointer mask, LIU Zhiwei, 2023/03/27
- Re: [PATCH 1/5] target/riscv: Fix effective address for pointer mask, liweiwei, 2023/03/27
- Re: [PATCH 1/5] target/riscv: Fix effective address for pointer mask, LIU Zhiwei, 2023/03/28
- Re: [PATCH 1/5] target/riscv: Fix effective address for pointer mask, liweiwei, 2023/03/28
[PATCH 2/5] target/riscv: Use sign-extended data address when xl = 32,
Weiwei Li <=