All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bug 1885350] [NEW] RISCV dynamic rounding mode is not behaving correctly
@ 2020-06-27  5:47 Mina Magdy
  2020-06-27 11:08 ` [Bug 1885350] " Mina Magdy
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Mina Magdy @ 2020-06-27  5:47 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

Hello,

I’ve gone through the RISC-V code in latest QEMU release
(qemu-5.0.0-rc2) and when checking the Floating point encodings I found
the rounding mode is only updated if the opcode field “rm” is changed
“ctx->frm == rm”. But according to RISC-V Volume I: Unprivileged ISA,
there’s a dynamic mode when rm=7 where the rounding mode is set with frm
value.

So for the same rm value (=7) and when changing frm value seeking
different rounding modes, and according to the below code, the rounding
mode won’t be updated. Please correct me if I got this implementation
wrong.

static void gen_set_rm(DisasContext *ctx, int rm)
{
    TCGv_i32 t0;
    if (ctx->frm == rm) {
        return;
    }
    ctx->frm = rm;
    t0 = tcg_const_i32(rm);
    gen_helper_set_rounding_mode(cpu_env, t0);
    tcg_temp_free_i32(t0);
}


My testcase:
I set statically the rm field in the instruction to 7 and before this execution I changed the value of frm field in fcsr register. For the 1st time it worked (according to the code above, the rm is updated so the round mode will also be updated). But when changing fcsr register an re-execute the instruction, there's no difference and the rounding mode is the same like the previous frm value.

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1885350

Title:
  RISCV dynamic rounding mode is not behaving correctly

Status in QEMU:
  New

Bug description:
  Hello,

  I’ve gone through the RISC-V code in latest QEMU release
  (qemu-5.0.0-rc2) and when checking the Floating point encodings I
  found the rounding mode is only updated if the opcode field “rm” is
  changed “ctx->frm == rm”. But according to RISC-V Volume I:
  Unprivileged ISA, there’s a dynamic mode when rm=7 where the rounding
  mode is set with frm value.

  So for the same rm value (=7) and when changing frm value seeking
  different rounding modes, and according to the below code, the
  rounding mode won’t be updated. Please correct me if I got this
  implementation wrong.

  static void gen_set_rm(DisasContext *ctx, int rm)
  {
      TCGv_i32 t0;
      if (ctx->frm == rm) {
          return;
      }
      ctx->frm = rm;
      t0 = tcg_const_i32(rm);
      gen_helper_set_rounding_mode(cpu_env, t0);
      tcg_temp_free_i32(t0);
  }

  
  My testcase:
  I set statically the rm field in the instruction to 7 and before this execution I changed the value of frm field in fcsr register. For the 1st time it worked (according to the code above, the rm is updated so the round mode will also be updated). But when changing fcsr register an re-execute the instruction, there's no difference and the rounding mode is the same like the previous frm value.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1885350/+subscriptions


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug 1885350] Re: RISCV dynamic rounding mode is not behaving correctly
  2020-06-27  5:47 [Bug 1885350] [NEW] RISCV dynamic rounding mode is not behaving correctly Mina Magdy
@ 2020-06-27 11:08 ` Mina Magdy
  2020-06-30 17:34 ` Alistair Francis
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Mina Magdy @ 2020-06-27 11:08 UTC (permalink / raw)
  To: qemu-devel

After checking RISCY RTL code, i found the implementation is straight forward as stated in specs as follows:
              if (FPU == 1) begin
                 if (fp_rnd_mode == 3'b111)
                   apu_flags = frm_i;
                 else
                   apu_flags = fp_rnd_mode;
              end else

where fp_rnd_mode  is the round mode field in the instruction opcode.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1885350

Title:
  RISCV dynamic rounding mode is not behaving correctly

Status in QEMU:
  New

Bug description:
  Hello,

  I’ve gone through the RISC-V code in latest QEMU release
  (qemu-5.0.0-rc2) and when checking the Floating point encodings I
  found the rounding mode is only updated if the opcode field “rm” is
  changed “ctx->frm == rm”. But according to RISC-V Volume I:
  Unprivileged ISA, there’s a dynamic mode when rm=7 where the rounding
  mode is set with frm value.

  So for the same rm value (=7) and when changing frm value seeking
  different rounding modes, and according to the below code, the
  rounding mode won’t be updated. Please correct me if I got this
  implementation wrong.

  static void gen_set_rm(DisasContext *ctx, int rm)
  {
      TCGv_i32 t0;
      if (ctx->frm == rm) {
          return;
      }
      ctx->frm = rm;
      t0 = tcg_const_i32(rm);
      gen_helper_set_rounding_mode(cpu_env, t0);
      tcg_temp_free_i32(t0);
  }

  
  My testcase:
  I set statically the rm field in the instruction to 7 and before this execution I changed the value of frm field in fcsr register. For the 1st time it worked (according to the code above, the rm is updated so the round mode will also be updated). But when changing fcsr register an re-execute the instruction, there's no difference and the rounding mode is the same like the previous frm value.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1885350/+subscriptions


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug 1885350] Re: RISCV dynamic rounding mode is not behaving correctly
  2020-06-27  5:47 [Bug 1885350] [NEW] RISCV dynamic rounding mode is not behaving correctly Mina Magdy
  2020-06-27 11:08 ` [Bug 1885350] " Mina Magdy
@ 2020-06-30 17:34 ` Alistair Francis
  2020-06-30 20:43 ` Alistair Francis
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alistair Francis @ 2020-06-30 17:34 UTC (permalink / raw)
  To: qemu-devel

** Changed in: qemu
     Assignee: (unassigned) => Alistair Francis (alistair2323)

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1885350

Title:
  RISCV dynamic rounding mode is not behaving correctly

Status in QEMU:
  New

Bug description:
  Hello,

  I’ve gone through the RISC-V code in latest QEMU release
  (qemu-5.0.0-rc2) and when checking the Floating point encodings I
  found the rounding mode is only updated if the opcode field “rm” is
  changed “ctx->frm == rm”. But according to RISC-V Volume I:
  Unprivileged ISA, there’s a dynamic mode when rm=7 where the rounding
  mode is set with frm value.

  So for the same rm value (=7) and when changing frm value seeking
  different rounding modes, and according to the below code, the
  rounding mode won’t be updated. Please correct me if I got this
  implementation wrong.

  static void gen_set_rm(DisasContext *ctx, int rm)
  {
      TCGv_i32 t0;
      if (ctx->frm == rm) {
          return;
      }
      ctx->frm = rm;
      t0 = tcg_const_i32(rm);
      gen_helper_set_rounding_mode(cpu_env, t0);
      tcg_temp_free_i32(t0);
  }

  
  My testcase:
  I set statically the rm field in the instruction to 7 and before this execution I changed the value of frm field in fcsr register. For the 1st time it worked (according to the code above, the rm is updated so the round mode will also be updated). But when changing fcsr register an re-execute the instruction, there's no difference and the rounding mode is the same like the previous frm value.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1885350/+subscriptions


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug 1885350] Re: RISCV dynamic rounding mode is not behaving correctly
  2020-06-27  5:47 [Bug 1885350] [NEW] RISCV dynamic rounding mode is not behaving correctly Mina Magdy
  2020-06-27 11:08 ` [Bug 1885350] " Mina Magdy
  2020-06-30 17:34 ` Alistair Francis
@ 2020-06-30 20:43 ` Alistair Francis
  2020-06-30 20:59 ` Mina Magdy
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alistair Francis @ 2020-06-30 20:43 UTC (permalink / raw)
  To: qemu-devel

This does look like incorrect behaviour. I have sent a patch to the
mailing list. You can see the patch here:
https://patchew.org/QEMU/cover.1593547870.git.alistair.francis@wdc.com/ea4f280e6f77e734c8e555e3c98d10085ce9f5b6.1593547870.git.alistair.francis@wdc.com/

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1885350

Title:
  RISCV dynamic rounding mode is not behaving correctly

Status in QEMU:
  New

Bug description:
  Hello,

  I’ve gone through the RISC-V code in latest QEMU release
  (qemu-5.0.0-rc2) and when checking the Floating point encodings I
  found the rounding mode is only updated if the opcode field “rm” is
  changed “ctx->frm == rm”. But according to RISC-V Volume I:
  Unprivileged ISA, there’s a dynamic mode when rm=7 where the rounding
  mode is set with frm value.

  So for the same rm value (=7) and when changing frm value seeking
  different rounding modes, and according to the below code, the
  rounding mode won’t be updated. Please correct me if I got this
  implementation wrong.

  static void gen_set_rm(DisasContext *ctx, int rm)
  {
      TCGv_i32 t0;
      if (ctx->frm == rm) {
          return;
      }
      ctx->frm = rm;
      t0 = tcg_const_i32(rm);
      gen_helper_set_rounding_mode(cpu_env, t0);
      tcg_temp_free_i32(t0);
  }

  
  My testcase:
  I set statically the rm field in the instruction to 7 and before this execution I changed the value of frm field in fcsr register. For the 1st time it worked (according to the code above, the rm is updated so the round mode will also be updated). But when changing fcsr register an re-execute the instruction, there's no difference and the rounding mode is the same like the previous frm value.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1885350/+subscriptions


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug 1885350] Re: RISCV dynamic rounding mode is not behaving correctly
  2020-06-27  5:47 [Bug 1885350] [NEW] RISCV dynamic rounding mode is not behaving correctly Mina Magdy
                   ` (2 preceding siblings ...)
  2020-06-30 20:43 ` Alistair Francis
@ 2020-06-30 20:59 ` Mina Magdy
  2020-11-19 20:21 ` Alistair Francis
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Mina Magdy @ 2020-06-30 20:59 UTC (permalink / raw)
  To: qemu-devel

Thank you Alistair Francis.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1885350

Title:
  RISCV dynamic rounding mode is not behaving correctly

Status in QEMU:
  New

Bug description:
  Hello,

  I’ve gone through the RISC-V code in latest QEMU release
  (qemu-5.0.0-rc2) and when checking the Floating point encodings I
  found the rounding mode is only updated if the opcode field “rm” is
  changed “ctx->frm == rm”. But according to RISC-V Volume I:
  Unprivileged ISA, there’s a dynamic mode when rm=7 where the rounding
  mode is set with frm value.

  So for the same rm value (=7) and when changing frm value seeking
  different rounding modes, and according to the below code, the
  rounding mode won’t be updated. Please correct me if I got this
  implementation wrong.

  static void gen_set_rm(DisasContext *ctx, int rm)
  {
      TCGv_i32 t0;
      if (ctx->frm == rm) {
          return;
      }
      ctx->frm = rm;
      t0 = tcg_const_i32(rm);
      gen_helper_set_rounding_mode(cpu_env, t0);
      tcg_temp_free_i32(t0);
  }

  
  My testcase:
  I set statically the rm field in the instruction to 7 and before this execution I changed the value of frm field in fcsr register. For the 1st time it worked (according to the code above, the rm is updated so the round mode will also be updated). But when changing fcsr register an re-execute the instruction, there's no difference and the rounding mode is the same like the previous frm value.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1885350/+subscriptions


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug 1885350] Re: RISCV dynamic rounding mode is not behaving correctly
  2020-06-27  5:47 [Bug 1885350] [NEW] RISCV dynamic rounding mode is not behaving correctly Mina Magdy
                   ` (3 preceding siblings ...)
  2020-06-30 20:59 ` Mina Magdy
@ 2020-11-19 20:21 ` Alistair Francis
  2020-12-22  0:53 ` Alistair Francis
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alistair Francis @ 2020-11-19 20:21 UTC (permalink / raw)
  To: qemu-devel

As commented on the patch submission, this should already be handled:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg718331.html

Can you attach the test case that is failing?

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1885350

Title:
  RISCV dynamic rounding mode is not behaving correctly

Status in QEMU:
  New

Bug description:
  Hello,

  I’ve gone through the RISC-V code in latest QEMU release
  (qemu-5.0.0-rc2) and when checking the Floating point encodings I
  found the rounding mode is only updated if the opcode field “rm” is
  changed “ctx->frm == rm”. But according to RISC-V Volume I:
  Unprivileged ISA, there’s a dynamic mode when rm=7 where the rounding
  mode is set with frm value.

  So for the same rm value (=7) and when changing frm value seeking
  different rounding modes, and according to the below code, the
  rounding mode won’t be updated. Please correct me if I got this
  implementation wrong.

  static void gen_set_rm(DisasContext *ctx, int rm)
  {
      TCGv_i32 t0;
      if (ctx->frm == rm) {
          return;
      }
      ctx->frm = rm;
      t0 = tcg_const_i32(rm);
      gen_helper_set_rounding_mode(cpu_env, t0);
      tcg_temp_free_i32(t0);
  }

  
  My testcase:
  I set statically the rm field in the instruction to 7 and before this execution I changed the value of frm field in fcsr register. For the 1st time it worked (according to the code above, the rm is updated so the round mode will also be updated). But when changing fcsr register an re-execute the instruction, there's no difference and the rounding mode is the same like the previous frm value.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1885350/+subscriptions


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug 1885350] Re: RISCV dynamic rounding mode is not behaving correctly
  2020-06-27  5:47 [Bug 1885350] [NEW] RISCV dynamic rounding mode is not behaving correctly Mina Magdy
                   ` (4 preceding siblings ...)
  2020-11-19 20:21 ` Alistair Francis
@ 2020-12-22  0:53 ` Alistair Francis
  2021-05-17 18:58 ` Thomas Huth
  2021-07-17  4:17 ` Launchpad Bug Tracker
  7 siblings, 0 replies; 9+ messages in thread
From: Alistair Francis @ 2020-12-22  0:53 UTC (permalink / raw)
  To: qemu-devel

** Changed in: qemu
       Status: New => Incomplete

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1885350

Title:
  RISCV dynamic rounding mode is not behaving correctly

Status in QEMU:
  Incomplete

Bug description:
  Hello,

  I’ve gone through the RISC-V code in latest QEMU release
  (qemu-5.0.0-rc2) and when checking the Floating point encodings I
  found the rounding mode is only updated if the opcode field “rm” is
  changed “ctx->frm == rm”. But according to RISC-V Volume I:
  Unprivileged ISA, there’s a dynamic mode when rm=7 where the rounding
  mode is set with frm value.

  So for the same rm value (=7) and when changing frm value seeking
  different rounding modes, and according to the below code, the
  rounding mode won’t be updated. Please correct me if I got this
  implementation wrong.

  static void gen_set_rm(DisasContext *ctx, int rm)
  {
      TCGv_i32 t0;
      if (ctx->frm == rm) {
          return;
      }
      ctx->frm = rm;
      t0 = tcg_const_i32(rm);
      gen_helper_set_rounding_mode(cpu_env, t0);
      tcg_temp_free_i32(t0);
  }

  
  My testcase:
  I set statically the rm field in the instruction to 7 and before this execution I changed the value of frm field in fcsr register. For the 1st time it worked (according to the code above, the rm is updated so the round mode will also be updated). But when changing fcsr register an re-execute the instruction, there's no difference and the rounding mode is the same like the previous frm value.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1885350/+subscriptions


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug 1885350] Re: RISCV dynamic rounding mode is not behaving correctly
  2020-06-27  5:47 [Bug 1885350] [NEW] RISCV dynamic rounding mode is not behaving correctly Mina Magdy
                   ` (5 preceding siblings ...)
  2020-12-22  0:53 ` Alistair Francis
@ 2021-05-17 18:58 ` Thomas Huth
  2021-07-17  4:17 ` Launchpad Bug Tracker
  7 siblings, 0 replies; 9+ messages in thread
From: Thomas Huth @ 2021-05-17 18:58 UTC (permalink / raw)
  To: qemu-devel

The QEMU project is currently moving its bug tracking to another system.
Is there still anything left to do here? If so, please provide the test case and switch the state back to "New" or "Confirmed", or open a new ticket in the new bug tracker here: https://gitlab.com/qemu-project/qemu/-/issues

** Changed in: qemu
     Assignee: Alistair Francis (alistair2323) => (unassigned)

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1885350

Title:
  RISCV dynamic rounding mode is not behaving correctly

Status in QEMU:
  Incomplete

Bug description:
  Hello,

  I’ve gone through the RISC-V code in latest QEMU release
  (qemu-5.0.0-rc2) and when checking the Floating point encodings I
  found the rounding mode is only updated if the opcode field “rm” is
  changed “ctx->frm == rm”. But according to RISC-V Volume I:
  Unprivileged ISA, there’s a dynamic mode when rm=7 where the rounding
  mode is set with frm value.

  So for the same rm value (=7) and when changing frm value seeking
  different rounding modes, and according to the below code, the
  rounding mode won’t be updated. Please correct me if I got this
  implementation wrong.

  static void gen_set_rm(DisasContext *ctx, int rm)
  {
      TCGv_i32 t0;
      if (ctx->frm == rm) {
          return;
      }
      ctx->frm = rm;
      t0 = tcg_const_i32(rm);
      gen_helper_set_rounding_mode(cpu_env, t0);
      tcg_temp_free_i32(t0);
  }

  
  My testcase:
  I set statically the rm field in the instruction to 7 and before this execution I changed the value of frm field in fcsr register. For the 1st time it worked (according to the code above, the rm is updated so the round mode will also be updated). But when changing fcsr register an re-execute the instruction, there's no difference and the rounding mode is the same like the previous frm value.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1885350/+subscriptions


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug 1885350] Re: RISCV dynamic rounding mode is not behaving correctly
  2020-06-27  5:47 [Bug 1885350] [NEW] RISCV dynamic rounding mode is not behaving correctly Mina Magdy
                   ` (6 preceding siblings ...)
  2021-05-17 18:58 ` Thomas Huth
@ 2021-07-17  4:17 ` Launchpad Bug Tracker
  7 siblings, 0 replies; 9+ messages in thread
From: Launchpad Bug Tracker @ 2021-07-17  4:17 UTC (permalink / raw)
  To: qemu-devel

[Expired for QEMU because there has been no activity for 60 days.]

** Changed in: qemu
       Status: Incomplete => Expired

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1885350

Title:
  RISCV dynamic rounding mode is not behaving correctly

Status in QEMU:
  Expired

Bug description:
  Hello,

  I’ve gone through the RISC-V code in latest QEMU release
  (qemu-5.0.0-rc2) and when checking the Floating point encodings I
  found the rounding mode is only updated if the opcode field “rm” is
  changed “ctx->frm == rm”. But according to RISC-V Volume I:
  Unprivileged ISA, there’s a dynamic mode when rm=7 where the rounding
  mode is set with frm value.

  So for the same rm value (=7) and when changing frm value seeking
  different rounding modes, and according to the below code, the
  rounding mode won’t be updated. Please correct me if I got this
  implementation wrong.

  static void gen_set_rm(DisasContext *ctx, int rm)
  {
      TCGv_i32 t0;
      if (ctx->frm == rm) {
          return;
      }
      ctx->frm = rm;
      t0 = tcg_const_i32(rm);
      gen_helper_set_rounding_mode(cpu_env, t0);
      tcg_temp_free_i32(t0);
  }

  
  My testcase:
  I set statically the rm field in the instruction to 7 and before this execution I changed the value of frm field in fcsr register. For the 1st time it worked (according to the code above, the rm is updated so the round mode will also be updated). But when changing fcsr register an re-execute the instruction, there's no difference and the rounding mode is the same like the previous frm value.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1885350/+subscriptions



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-07-17  4:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-27  5:47 [Bug 1885350] [NEW] RISCV dynamic rounding mode is not behaving correctly Mina Magdy
2020-06-27 11:08 ` [Bug 1885350] " Mina Magdy
2020-06-30 17:34 ` Alistair Francis
2020-06-30 20:43 ` Alistair Francis
2020-06-30 20:59 ` Mina Magdy
2020-11-19 20:21 ` Alistair Francis
2020-12-22  0:53 ` Alistair Francis
2021-05-17 18:58 ` Thomas Huth
2021-07-17  4:17 ` Launchpad Bug Tracker

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.