qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/1] Fix LP#1841442 for powerpc
@ 2019-08-26 16:54 Richard Henderson
  2019-08-26 16:54 ` [Qemu-devel] [PATCH 1/1] target/ppc: Fix do_float_check_status vs inexact Richard Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Henderson @ 2019-08-26 16:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-ppc, pc, david

I only attempt to fix this bug for powerpc at the moment.

For x86_64... there is no existing attempt to handle fp
exceptions at all.  It will be quite the job to fix.


r~


Richard Henderson (1):
  target/ppc: Fix do_float_check_status vs inexact

 target/ppc/fpu_helper.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

-- 
2.17.1



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

* [Qemu-devel] [PATCH 1/1] target/ppc: Fix do_float_check_status vs inexact
  2019-08-26 16:54 [Qemu-devel] [PATCH 0/1] Fix LP#1841442 for powerpc Richard Henderson
@ 2019-08-26 16:54 ` Richard Henderson
  2019-08-26 20:43   ` Paul Clarke
  2019-08-27  3:42   ` David Gibson
  0 siblings, 2 replies; 4+ messages in thread
From: Richard Henderson @ 2019-08-26 16:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-ppc, pc, david

The underflow and inexact exceptions are not mutually exclusive.
Check for both of them.  Tidy the reset of FPSCR[FI].

Fixes: https://bugs.launchpad.net/bugs/1841442
Reported-by: Paul Clarke <pc@us.ibm.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/ppc/fpu_helper.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c
index 07bc9051b0..2e023c5204 100644
--- a/target/ppc/fpu_helper.c
+++ b/target/ppc/fpu_helper.c
@@ -630,19 +630,15 @@ static void do_float_check_status(CPUPPCState *env, uintptr_t raddr)
 {
     CPUState *cs = env_cpu(env);
     int status = get_float_exception_flags(&env->fp_status);
-    bool inexact_happened = false;
 
     if (status & float_flag_overflow) {
         float_overflow_excp(env);
     } else if (status & float_flag_underflow) {
         float_underflow_excp(env);
-    } else if (status & float_flag_inexact) {
-        float_inexact_excp(env);
-        inexact_happened = true;
     }
-
-    /* if the inexact flag was not set */
-    if (inexact_happened == false) {
+    if (status & float_flag_inexact) {
+        float_inexact_excp(env);
+    } else {
         env->fpscr &= ~(1 << FPSCR_FI); /* clear the FPSCR[FI] bit */
     }
 
-- 
2.17.1



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

* Re: [Qemu-devel] [PATCH 1/1] target/ppc: Fix do_float_check_status vs inexact
  2019-08-26 16:54 ` [Qemu-devel] [PATCH 1/1] target/ppc: Fix do_float_check_status vs inexact Richard Henderson
@ 2019-08-26 20:43   ` Paul Clarke
  2019-08-27  3:42   ` David Gibson
  1 sibling, 0 replies; 4+ messages in thread
From: Paul Clarke @ 2019-08-26 20:43 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: qemu-ppc, david

On 8/26/19 11:54 AM, Richard Henderson wrote:
> The underflow and inexact exceptions are not mutually exclusive.
> Check for both of them.  Tidy the reset of FPSCR[FI].
> 
> Fixes: https://bugs.launchpad.net/bugs/1841442
> Reported-by: Paul Clarke <pc@us.ibm.com>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Tested-by: Paul Clarke <pc@us.ibm.com>

Thanks, Richard!

There seems to be a similar problem with underflow.  I'll narrow down a test case, and I guess I'll just open a new bug report.

PC
> ---
>  target/ppc/fpu_helper.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c
> index 07bc9051b0..2e023c5204 100644
> --- a/target/ppc/fpu_helper.c
> +++ b/target/ppc/fpu_helper.c
> @@ -630,19 +630,15 @@ static void do_float_check_status(CPUPPCState *env, uintptr_t raddr)
>  {
>      CPUState *cs = env_cpu(env);
>      int status = get_float_exception_flags(&env->fp_status);
> -    bool inexact_happened = false;
>  
>      if (status & float_flag_overflow) {
>          float_overflow_excp(env);
>      } else if (status & float_flag_underflow) {
>          float_underflow_excp(env);
> -    } else if (status & float_flag_inexact) {
> -        float_inexact_excp(env);
> -        inexact_happened = true;
>      }
> -
> -    /* if the inexact flag was not set */
> -    if (inexact_happened == false) {
> +    if (status & float_flag_inexact) {
> +        float_inexact_excp(env);
> +    } else {
>          env->fpscr &= ~(1 << FPSCR_FI); /* clear the FPSCR[FI] bit */
>      }
>  
> 


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

* Re: [Qemu-devel] [PATCH 1/1] target/ppc: Fix do_float_check_status vs inexact
  2019-08-26 16:54 ` [Qemu-devel] [PATCH 1/1] target/ppc: Fix do_float_check_status vs inexact Richard Henderson
  2019-08-26 20:43   ` Paul Clarke
@ 2019-08-27  3:42   ` David Gibson
  1 sibling, 0 replies; 4+ messages in thread
From: David Gibson @ 2019-08-27  3:42 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-ppc, qemu-devel, pc

[-- Attachment #1: Type: text/plain, Size: 1700 bytes --]

On Mon, Aug 26, 2019 at 09:54:34AM -0700, Richard Henderson wrote:
> The underflow and inexact exceptions are not mutually exclusive.
> Check for both of them.  Tidy the reset of FPSCR[FI].
> 
> Fixes: https://bugs.launchpad.net/bugs/1841442
> Reported-by: Paul Clarke <pc@us.ibm.com>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Applied to ppc-for-4.2, thanks.

> ---
>  target/ppc/fpu_helper.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c
> index 07bc9051b0..2e023c5204 100644
> --- a/target/ppc/fpu_helper.c
> +++ b/target/ppc/fpu_helper.c
> @@ -630,19 +630,15 @@ static void do_float_check_status(CPUPPCState *env, uintptr_t raddr)
>  {
>      CPUState *cs = env_cpu(env);
>      int status = get_float_exception_flags(&env->fp_status);
> -    bool inexact_happened = false;
>  
>      if (status & float_flag_overflow) {
>          float_overflow_excp(env);
>      } else if (status & float_flag_underflow) {
>          float_underflow_excp(env);
> -    } else if (status & float_flag_inexact) {
> -        float_inexact_excp(env);
> -        inexact_happened = true;
>      }
> -
> -    /* if the inexact flag was not set */
> -    if (inexact_happened == false) {
> +    if (status & float_flag_inexact) {
> +        float_inexact_excp(env);
> +    } else {
>          env->fpscr &= ~(1 << FPSCR_FI); /* clear the FPSCR[FI] bit */
>      }
>  

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2019-08-27  4:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-26 16:54 [Qemu-devel] [PATCH 0/1] Fix LP#1841442 for powerpc Richard Henderson
2019-08-26 16:54 ` [Qemu-devel] [PATCH 1/1] target/ppc: Fix do_float_check_status vs inexact Richard Henderson
2019-08-26 20:43   ` Paul Clarke
2019-08-27  3:42   ` David Gibson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).