From a657e0a74dbd34bc3296ba63e7e4836cc1f62aef Mon Sep 17 00:00:00 2001 From: martynas Date: Tue, 7 Oct 2008 22:06:29 +0000 Subject: unbreak ieeefp emulation code wrt converting double to unsigned long ints for alpha. we've got only one instruction (cvttq) to convert double-t to quadword, and float64_to_int64 did not take into account the unsigned conversions therefore, overflow always occured, and half of the unsigned range (LONG_MAX .. ULONG_MAX) was broken introduce roundAndPackInt64NoOverflow and float64_to_int64_no_overflow for softfloat, that works with unsigned integers as well. note that this will return zero for nan/inf/oflow/uflow, raising exception flag perl is happy now looked over by miod@ tested by naddy@, and by me on nick@'s alpha --- sys/lib/libkern/softfloat.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sys/lib/libkern/softfloat.h') diff --git a/sys/lib/libkern/softfloat.h b/sys/lib/libkern/softfloat.h index cc2bd1fbad9..cc5ed44172e 100644 --- a/sys/lib/libkern/softfloat.h +++ b/sys/lib/libkern/softfloat.h @@ -1,4 +1,4 @@ -/* $OpenBSD: softfloat.h,v 1.3 2008/06/26 05:42:20 ray Exp $ */ +/* $OpenBSD: softfloat.h,v 1.4 2008/10/07 22:06:29 martynas Exp $ */ /* $NetBSD: softfloat.h,v 1.1 2001/04/26 03:10:48 ross Exp $ */ /* This is a derivative work. */ @@ -232,6 +232,9 @@ int float64_to_int32( float64 ); int float64_to_int32_round_to_zero( float64 ); #ifndef SOFTFLOAT_FOR_GCC /* __fix?fdi provided by libgcc2.c */ int64_t float64_to_int64( float64 ); +#ifdef __alpha__ +int64_t float64_to_int64_no_overflow( float64 ); +#endif /* __alpha__ */ int64_t float64_to_int64_round_to_zero( float64 ); #endif float32 float64_to_float32( float64 ); -- cgit v1.2.3-59-g8ed1b