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