qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2 01/26] s390x/tcg: Fix FP CONVERT TO (LOGICAL) FIXED NaN ha


From: David Hildenbrand
Subject: Re: [PATCH v2 01/26] s390x/tcg: Fix FP CONVERT TO (LOGICAL) FIXED NaN handling
Date: Wed, 2 Jun 2021 11:50:40 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1

On 01.06.21 23:27, Richard Henderson wrote:
On 5/17/21 7:27 AM, David Hildenbrand wrote:
@@ -634,6 +664,9 @@ uint64_t HELPER(clfxb)(CPUS390XState *env, uint64_t h, 
uint64_t l, uint32_t m34)
s390_restore_bfp_rounding_mode(env, old_mode);
      handle_exceptions(env, xxc_from_m34(m34), GETPC());
+    if (float128_is_any_nan(make_float128(h, l))) {
+        return 0;
+    }

I wonder if handle_exceptions should return s390_exc.
Then you can test

    exc = handle_exceptions(...);
    if (unlikely(exc & S390_IEEE_MASK_INVALID)) {
      ret = 0;
    }
    return ret;


I'll give it a thought if that makes things easier.



+++ b/target/s390x/vec_fpu_helper.c
@@ -326,6 +326,9 @@ void HELPER(gvec_vcdlg64s)(void *v1, const void *v2, 
CPUS390XState *env,
static uint64_t vcgd64(uint64_t a, float_status *s)
   {
+    if (float64_is_any_nan(a)) {
+        return INT64_MIN;
+    }
       return float64_to_int64(a, s);
   }
@@ -349,6 +352,9 @@ void HELPER(gvec_vcgd64s)(void *v1, const void *v2, CPUS390XState *env, static uint64_t vclgd64(uint64_t a, float_status *s)
   {
+    if (float64_is_any_nan(a)) {
+        return 0;
+    }
       return float64_to_uint64(a, s);
   }

You do still need to raise invalid, as far as I can see.

Good point, so maybe


uint64_t ret = float64_to_uint64(a, s);

/* Note: check after converting to properly raise exceptions. */
if (float64_is_any_nan(a)) {
        ret = 0;
}
return ret;


to minimize manual handling?

--
Thanks,

David / dhildenb




reply via email to

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