]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
target/ppc: Fix do_float_check_status vs inexact
authorRichard Henderson <richard.henderson@linaro.org>
Mon, 26 Aug 2019 16:54:34 +0000 (09:54 -0700)
committerDavid Gibson <david@gibson.dropbear.id.au>
Wed, 28 Aug 2019 23:46:07 +0000 (09:46 +1000)
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>
Message-Id: <20190826165434.18403-2-richard.henderson@linaro.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
target/ppc/fpu_helper.c

index c8e719272d6c740a85aa60340fdc8f1dc2f6f4a1..4b1a2e617803c72dad75eb4548b84dea5d20ebec 100644 (file)
@@ -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 */
     }