Received: from eggs.gnu.org ([209.51.188.92]:46572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h0mJQ-0000SW-OT for qemu-devel@nongnu.org; Mon, 04 Mar 2019 07:03:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h0mJP-0001EO-UE for qemu-devel@nongnu.org; Mon, 04 Mar 2019 07:03:16 -0500 From: Cornelia Huck Date: Mon, 4 Mar 2019 13:01:57 +0100 Message-Id: <20190304120210.31500-15-cohuck@redhat.com> In-Reply-To: <20190304120210.31500-1-cohuck@redhat.com> References: <20190304120210.31500-1-cohuck@redhat.com> Subject: [Qemu-devel] [PULL 14/27] s390x/tcg: Fix rounding from float128 to uint64_t/uint32_t List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-s390x@nongnu.org, qemu-devel@nongnu.org, David Hildenbrand , Cornelia Huck From: David Hildenbrand Let's use the proper conversion functions now that we have them. Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand Message-Id: <20190218122710.23639-3-david@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/fpu_helper.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/target/s390x/fpu_helper.c b/target/s390x/fpu_helper.c index 0e9247bf7ef4..21236caed869 100644 --- a/target/s390x/fpu_helper.c +++ b/target/s390x/fpu_helper.c @@ -509,9 +509,7 @@ uint64_t HELPER(clgdb)(CPUS390XState *env, uint64_t v2, uint32_t m3) uint64_t HELPER(clgxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_t m3) { int hold = swap_round_mode(env, m3); - float128 v2 = make_float128(h, l); - /* ??? Not 100% correct. */ - uint64_t ret = float128_to_int64(v2, &env->fpu_status); + uint64_t ret = float128_to_uint64(make_float128(h, l), &env->fpu_status); set_float_rounding_mode(hold, &env->fpu_status); handle_exceptions(env, GETPC()); return ret; @@ -541,9 +539,7 @@ uint64_t HELPER(clfdb)(CPUS390XState *env, uint64_t v2, uint32_t m3) uint64_t HELPER(clfxb)(CPUS390XState *env, uint64_t h, uint64_t l, uint32_t m3) { int hold = swap_round_mode(env, m3); - float128 v2 = make_float128(h, l); - /* Not 100% correct. */ - uint32_t ret = float128_to_int64(v2, &env->fpu_status); + uint32_t ret = float128_to_uint32(make_float128(h, l), &env->fpu_status); set_float_rounding_mode(hold, &env->fpu_status); handle_exceptions(env, GETPC()); return ret; -- 2.17.2