This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: i386/cygwin fpu hard-float [l]{0-2}rint[lf]? implementation pt. 1


Dave Korn wrote:
On 18 December 2007 20:04, Jeff Johnston wrote:

Hi Dave,

   After looking at it, I tend to agree with you that you have really
provided fastmath versions of the functions.  In keeping with that, I
renamed the functions appropriately, removed the inclusion of common
code (not needed), and fixed up math.h (can't assume all types exist)

Thanks for doing all this!


and added the functions to libc/machine/i386/machine/fastmath.h.

That bit was missing from your patch. I could probably reproduce it locally by following the existing patterns - should I be using _LONG_LONG et al. here as well, or do the #if guards guarantee that those types will be available?


Sorry, missed it. Attached here. The types are ok here because this directory is only for i386.


   I have included the modified patch with this.  Please look at it and
try it out if you are ok with it.

I'll give it a quick test. I'm certainly ok with it, it seems like a better way to implement it to me.

   The consequence of my tinkering is that there is no default versions
for lrintl, rintl, llrint, llrintf, and llrintl (i.e. the new
functions).  This could be remedied by adding s* C code that calls the
_f_ versions for the time-being until they are eventually added to the
common directory.  The alternative is that -ffast-math is required to
use these functions.  I'll let you decide which you prefer.  In the
soft-float case, the functions don't exist.

Righto. I'll add the s* files/functions, because -ffast-math appears to have some problems currently, and people might want to avoid it but still get the new functions. I also note that you had the same excess changes as I did when you regenerated Makefile.in, so I won't worry about those, they look basically like noise anyway.


Ok. You can send me a diff patch from mine and I'll apply it.


Please also create a total ChangeLog for me to use. Thanks.

-- Jeff J.


cheers, DaveK

Index: libc/machine/i386/machine/fastmath.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/machine/i386/machine/fastmath.h,v
retrieving revision 1.2
diff -u -p -r1.2 fastmath.h
--- libc/machine/i386/machine/fastmath.h	17 Oct 2007 19:36:43 -0000	1.2
+++ libc/machine/i386/machine/fastmath.h	18 Dec 2007 21:39:11 -0000
@@ -26,6 +26,7 @@ __extension__ double tan(double)
 
 #if !defined(__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >= 199901L
 
+
 __extension__ float atan2f(float, float)
   __asm__(__U_L_PREFIX__ "_f_atan2f");
 __extension__ float expf(float)
@@ -34,12 +35,30 @@ __extension__ float frexpf(float, int*)
   __asm__(__U_L_PREFIX__ "_f_frexpf");
 __extension__ float ldexpf(float, int)
   __asm__(__U_L_PREFIX__ "_f_ldexpf");
+__extension__ long long llrint(double)
+  __asm__(__U_L_PREFIX__ "_f_llrint");
+__extension__ long long llrintf(float)
+  __asm__(__U_L_PREFIX__ "_f_llrintf");
+__extension__ long long llrintl(long double)
+  __asm__(__U_L_PREFIX__ "_f_llrintl");
 __extension__ float logf(float)
   __asm__(__U_L_PREFIX__ "_f_logf");
 __extension__ float log10f(float)
   __asm__(__U_L_PREFIX__ "_f_log10f");
+__extension__ long lrint(double)
+  __asm__(__U_L_PREFIX__ "_f_lrint");
+__extension__ long lrintf(float)
+  __asm__(__U_L_PREFIX__ "_f_lrintf");
+__extension__ long lrintl(long double)
+  __asm__(__U_L_PREFIX__ "_f_lrintl");
 __extension__ float powf(float, float)
   __asm__(__U_L_PREFIX__ "_f_powf");
+__extension__ double rint(double)
+  __asm__(__U_L_PREFIX__ "_f_rint");
+__extension__ float rintf(float)
+  __asm__(__U_L_PREFIX__ "_f_rintf");
+__extension__ long double rintl(long double)
+  __asm__(__U_L_PREFIX__ "_f_rintl");
 __extension__ float tanf(float)
   __asm__(__U_L_PREFIX__ "_f_tanf");
 #endif
@@ -54,14 +73,6 @@ double EXFUN(_f_log,(double));
 double EXFUN(_f_log10,(double));
 double EXFUN(_f_pow,(double, double));
 
-float EXFUN(_f_atan2f,(float, float));
-float EXFUN(_f_expf,(float));
-float EXFUN(_f_frexpf,(float, int*));
-float EXFUN(_f_ldexpf,(float, int));
-float EXFUN(_f_logf,(float));
-float EXFUN(_f_log10f,(float));
-float EXFUN(_f_powf,(float, float));
-
 #define atan2(__y,__x)	_f_atan2((__y),(__x))
 #define exp(__x)	_f_exp(__x)
 #define frexp(__x,__p)	_f_frexp((__x),(__p))
@@ -71,13 +82,40 @@ float EXFUN(_f_powf,(float, float));
 #define pow(__x,__y)	_f_pow((__x),(__y))
 
 #ifndef __STRICT_ANSI__
+
+float EXFUN(_f_atan2f,(float, float));
+float EXFUN(_f_expf,(float));
+float EXFUN(_f_frexpf,(float, int*));
+float EXFUN(_f_ldexpf,(float, int));
+long long EXFUN(_f_llrint,(double));
+long long EXFUN(_f_llrintf,(float));
+long long EXFUN(_f_llrintl,(long double));
+float EXFUN(_f_logf,(float));
+float EXFUN(_f_log10f,(float));
+long EXFUN(_f_lrint,(double));
+long EXFUN(_f_lrintf,(float));
+long EXFUN(_f_lrintl,(long double));
+float EXFUN(_f_powf,(float, float));
+float EXFUN(_f_rint,(double));
+double EXFUN(_f_rintf,(float));
+long double EXFUN(_f_rintl,(long double));
+
 #define atan2f(__y,__x)	_f_atan2f((__y),(__x))
 #define expf(__x)	_f_expf(__x)
 #define frexpf(__x,__p)	_f_frexpf((__x),(__p))
 #define ldexpf(__x,__e)	_f_ldexpf((__x),(__e))
+#define llrint(__x)	_f_llrint((__x))
+#define llrintf(__x)	_f_llrintf((__x))
+#define llrintl(__x)	_f_llrintl((__x))
 #define logf(__x)	_f_logf(__x)
 #define log10f(__x)	_f_log10f(__x)
+#define lrint(__x)	_f_lrint((__x))
+#define lrintf(__x)	_f_lrintf((__x))
+#define lrintl(__x)	_f_lrintl((__x))
 #define powf(__x,y)	_f_powf((__x),(__y))
+#define rint(__x)	_f_rint((__x))
+#define rintf(__x)	_f_rintf((__x))
+#define rintl(__x)	_f_rintl((__x))
 #endif
 
 #endif /* GCC */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]