qemu-riscv
[Top][All Lists]
Advanced

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

Re: [PATCH 05/13] target/riscv: Calculate address according to ol


From: LIU Zhiwei
Subject: Re: [PATCH 05/13] target/riscv: Calculate address according to ol
Date: Mon, 1 Nov 2021 23:56:02 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0


On 2021/11/1 下午6:46, Richard Henderson wrote:
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,
Oops, an error 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.
The same error.

  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.
That's what I want to.

(1) OL is wrong, use XL.
OK.

(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.

Yes,  the XL truncation should be placed after gen_pm_adjust_address.
Maybe we can define a common routine to get address, and in the common routine
we calculate the address and adjust it with pointer mask and xl.

Thanks,
Zhiwei



r~



reply via email to

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