[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 05/13] target/riscv: Calculate address according to ol
From: |
Richard Henderson |
Subject: |
Re: [PATCH 05/13] target/riscv: Calculate address according to ol |
Date: |
Mon, 1 Nov 2021 06:46:25 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 |
On 11/1/21 6:01 AM, LIU Zhiwei wrote:
static bool trans_fld(DisasContext *ctx, arg_fld *a)
{
- TCGv addr;
+ TCGv src1 = get_gpr(ctx, a->rs1, EXT_NONE);
+ TCGv addr = temp_new(ctx);
REQUIRE_FPU;
REQUIRE_EXT(ctx, RVD);
- addr = get_gpr(ctx, a->rs1, EXT_NONE);
- if (a->imm) {
- TCGv temp = temp_new(ctx);
- tcg_gen_addi_tl(temp, addr, a->imm);
- addr = temp;
- }
+ tcg_gen_addi_tl(addr, src1, a->imm);
addr = gen_pm_adjust_address(ctx, addr);
No change here,
static bool trans_fsd(DisasContext *ctx, arg_fsd *a)
{
- TCGv addr;
+ TCGv src1 = get_gpr(ctx, a->rs1, EXT_NONE);
+ TCGv addr = temp_new(ctx);
REQUIRE_FPU;
REQUIRE_EXT(ctx, RVD);
- addr = get_gpr(ctx, a->rs1, EXT_NONE);
- if (a->imm) {
- TCGv temp = temp_new(ctx);
- tcg_gen_addi_tl(temp, addr, a->imm);
- addr = temp;
- }
+ tcg_gen_addi_tl(addr, src1, a->imm);
addr = gen_pm_adjust_address(ctx, addr);
Or here.
static bool trans_flw(DisasContext *ctx, arg_flw *a)
{
TCGv_i64 dest;
- TCGv addr;
+ TCGv src1 = get_gpr(ctx, a->rs1, EXT_NONE);
+ TCGv addr = temp_new(ctx);
REQUIRE_FPU;
REQUIRE_EXT(ctx, RVF);
- addr = get_gpr(ctx, a->rs1, EXT_NONE);
- if (a->imm) {
- TCGv temp = temp_new(ctx);
- tcg_gen_addi_tl(temp, addr, a->imm);
- addr = temp;
+ tcg_gen_addi_tl(addr, src1, a->imm);
+ if (ctx->ol == MXL_RV32) {
+ tcg_gen_ext32u_tl(addr, addr);
}
addr = gen_pm_adjust_address(ctx, addr);
But you did here.
(1) OL is wrong, use XL.
(2) The address adjustment should be done in some common routine.
Probably rename gen_pm_adjust_address to make it more generic,
then add the XL truncation there.
r~
- [PATCH 11/13] target/riscv: Switch context in exception return, (continued)
- [PATCH 04/13] target/riscv: Use gdb xml according to max mxlen, LIU Zhiwei, 2021/11/01
- [PATCH 01/13] target/riscv: Sign extend pc for different ol, LIU Zhiwei, 2021/11/01
- [PATCH 05/13] target/riscv: Calculate address according to ol, LIU Zhiwei, 2021/11/01
- Re: [PATCH 05/13] target/riscv: Calculate address according to ol,
Richard Henderson <=
- [PATCH 12/13] target/riscv: Don't save pc when exception return, LIU Zhiwei, 2021/11/01
- [PATCH 09/13] target/riscv: Adjust vector address with ol, LIU Zhiwei, 2021/11/01
- Re: [PATCH 09/13] target/riscv: Adjust vector address with ol, Richard Henderson, 2021/11/01
- Re: [PATCH 09/13] target/riscv: Adjust vector address with ol, LIU Zhiwei, 2021/11/08
- Re: [PATCH 09/13] target/riscv: Adjust vector address with ol, Richard Henderson, 2021/11/09
- Re: [PATCH 09/13] target/riscv: Adjust vector address with ol, LIU Zhiwei, 2021/11/09
- Re: [PATCH 09/13] target/riscv: Adjust vector address with ol, Richard Henderson, 2021/11/09
- Re: [PATCH 09/13] target/riscv: Adjust vector address with ol, LIU Zhiwei, 2021/11/09