diff options
author | David Hildenbrand <david@redhat.com> | 2021-06-08 11:23:12 +0200 |
---|---|---|
committer | Cornelia Huck <cohuck@redhat.com> | 2021-06-21 08:48:20 +0200 |
commit | 0a3be7be73e594388ae2a91017b7ffafab15a7d9 (patch) | |
tree | e26aaa57571872527864e5079871bd1e2c33dc0f /target/s390x/vec_fpu_helper.c | |
parent | 3fb3b122ac061859c20cdb14567313f137dbc152 (diff) |
s390x/tcg: Fix FP CONVERT TO (LOGICAL) FIXED NaN handling
In case we encounter a NaN, we have to return the smallest possible
number, corresponding to either 0 or the maximum negative number. This
seems to differ from IEEE handling as implemented in softfloat, whereby
we return the biggest possible number.
While at it, use float32_to_uint64() in the CLGEB handler.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20210608092337.12221-2-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Diffstat (limited to 'target/s390x/vec_fpu_helper.c')
-rw-r--r-- | target/s390x/vec_fpu_helper.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/target/s390x/vec_fpu_helper.c b/target/s390x/vec_fpu_helper.c index c1564e819b..56765918d2 100644 --- a/target/s390x/vec_fpu_helper.c +++ b/target/s390x/vec_fpu_helper.c @@ -326,7 +326,9 @@ void HELPER(gvec_vcdlg64s)(void *v1, const void *v2, CPUS390XState *env, static uint64_t vcgd64(uint64_t a, float_status *s) { - return float64_to_int64(a, s); + const uint64_t tmp = float64_to_int64(a, s); + + return float64_is_any_nan(a) ? INT64_MIN : tmp; } void HELPER(gvec_vcgd64)(void *v1, const void *v2, CPUS390XState *env, @@ -349,7 +351,9 @@ void HELPER(gvec_vcgd64s)(void *v1, const void *v2, CPUS390XState *env, static uint64_t vclgd64(uint64_t a, float_status *s) { - return float64_to_uint64(a, s); + const uint64_t tmp = float64_to_uint64(a, s); + + return float64_is_any_nan(a) ? 0 : tmp; } void HELPER(gvec_vclgd64)(void *v1, const void *v2, CPUS390XState *env, |