qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] target/alpha: Do not mix exception flags and FPCR bits
@ 2025-02-11 16:26 Philippe Mathieu-Daudé
  2025-02-11 16:49 ` Richard Henderson
  2025-03-06 13:13 ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-02-11 16:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Richard Henderson, Philippe Mathieu-Daudé

get_float_exception_flags() returns exception flags,
which are distinct from the FPCR bits used as error code.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
Based-on: <20250211130626.3940412-1-peter.maydell@linaro.org>
---
 target/alpha/fpu_helper.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/target/alpha/fpu_helper.c b/target/alpha/fpu_helper.c
index f810a9b6a47..6aefb9b851a 100644
--- a/target/alpha/fpu_helper.c
+++ b/target/alpha/fpu_helper.c
@@ -455,29 +455,28 @@ static uint64_t do_cvttq(CPUAlphaState *env, uint64_t a, int roundmode)
 {
     float64 fa;
     int64_t ret;
-    uint32_t exc;
+    uint32_t exc = 0;
+    int flags;
 
     fa = t_to_float64(a);
     ret = float64_to_int64_modulo(fa, roundmode, &FP_STATUS);
 
-    exc = get_float_exception_flags(&FP_STATUS);
-    if (unlikely(exc)) {
+    flags = get_float_exception_flags(&FP_STATUS);
+    if (unlikely(flags)) {
         set_float_exception_flags(0, &FP_STATUS);
 
         /* We need to massage the resulting exceptions. */
-        if (exc & float_flag_invalid_cvti) {
+        if (flags & float_flag_invalid_cvti) {
             /* Overflow, either normal or infinity. */
             if (float64_is_infinity(fa)) {
                 exc = FPCR_INV;
             } else {
                 exc = FPCR_IOV | FPCR_INE;
             }
-        } else if (exc & float_flag_invalid) {
+        } else if (flags & float_flag_invalid) {
             exc = FPCR_INV;
-        } else if (exc & float_flag_inexact) {
+        } else if (flags & float_flag_inexact) {
             exc = FPCR_INE;
-        } else {
-            exc = 0;
         }
     }
     env->error_code = exc;
-- 
2.47.1



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

* Re: [PATCH] target/alpha: Do not mix exception flags and FPCR bits
  2025-02-11 16:26 [PATCH] target/alpha: Do not mix exception flags and FPCR bits Philippe Mathieu-Daudé
@ 2025-02-11 16:49 ` Richard Henderson
  2025-03-06 13:13 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2025-02-11 16:49 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel; +Cc: Peter Maydell

On 2/11/25 08:26, Philippe Mathieu-Daudé wrote:
> get_float_exception_flags() returns exception flags,
> which are distinct from the FPCR bits used as error code.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> Based-on: <20250211130626.3940412-1-peter.maydell@linaro.org>
> ---
>   target/alpha/fpu_helper.c | 15 +++++++--------
>   1 file changed, 7 insertions(+), 8 deletions(-)

Yes, this is clearer.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~



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

* Re: [PATCH] target/alpha: Do not mix exception flags and FPCR bits
  2025-02-11 16:26 [PATCH] target/alpha: Do not mix exception flags and FPCR bits Philippe Mathieu-Daudé
  2025-02-11 16:49 ` Richard Henderson
@ 2025-03-06 13:13 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-06 13:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Richard Henderson

On 11/2/25 17:26, Philippe Mathieu-Daudé wrote:
> get_float_exception_flags() returns exception flags,
> which are distinct from the FPCR bits used as error code.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> Based-on: <20250211130626.3940412-1-peter.maydell@linaro.org>
> ---
>   target/alpha/fpu_helper.c | 15 +++++++--------
>   1 file changed, 7 insertions(+), 8 deletions(-)

Patch queued, thanks.


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

end of thread, other threads:[~2025-03-06 13:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-11 16:26 [PATCH] target/alpha: Do not mix exception flags and FPCR bits Philippe Mathieu-Daudé
2025-02-11 16:49 ` Richard Henderson
2025-03-06 13:13 ` Philippe Mathieu-Daudé

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).