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: 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~



reply via email to

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