qemu-riscv
[Top][All Lists]
Advanced

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

Re: [PATCH v8 30/62] target/riscv: Update fp_status when float rounding


From: LIU Zhiwei
Subject: Re: [PATCH v8 30/62] target/riscv: Update fp_status when float rounding mode changes
Date: Wed, 3 Jun 2020 13:46:25 +0800
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1



On 2020/6/3 12:27, Richard Henderson wrote:
On 5/21/20 2:43 AM, LIU Zhiwei wrote:
@@ -174,6 +175,9 @@ static int write_frm(CPURISCVState *env, int csrno, 
target_ulong val)
      env->mstatus |= MSTATUS_FS;
  #endif
      env->frm = val & (FSR_RD >> FSR_RD_SHIFT);
+    if (!riscv_cpu_set_rounding_mode(env, env->frm)) {
+        return -1;
+    }
This will raise an exception immediately in helper_csrrw().

According to Section 8.2, the no exception should occur until the next fp
operation that uses the invalid frm.

You're doing this just fine in helper_set_rounding_mode(), which is sufficient
for scalar fp ops.  Without looking forward to later patches, I suppose we'll
need to do something else for vector fp ops.
Hi Richard,

I think you are right.  Maybe I should transmit frm to ctx->frm, and check ctx->frm in vector fp ops.

We can set ctx->frm = env->frm instead of ctx->frm = -1 in riscv_tr_init_disas_context.
And  remove the sentence ctx->frm = rm; from gen_set_rm.

Is it right?

Zhiwei

r~




reply via email to

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