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

Jeff Johnston jjohnstn@redhat.com
Wed Dec 19 17:06:00 GMT 2007


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) 
and added the functions to libc/machine/i386/machine/fastmath.h.

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

   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.

-- Jeff J.

Dave Korn wrote:
> 
>     Hi Jeff,
> 
>   Here's part 1 of the new hw fp math functions for x86.  It adds the
> implementations themselves.  There's some documentation in the C files, but nothing
> trying to chew it yet.  I added the prototypes to math.h unconditionally - it's just
> occurred to me as an afterthought that I should probably have put them in
> fastmath.h, so I guess I'll need to respin this or just give you a follow-on patch
> that rolls back math.h and moves the prototypes across, at your preference.
> 
>   It's not customary to post a diff of the regenerated files, but I've attached one
> here because I'd like to ask you to eyeball it.  There seems to be a whole lot of
> peturbation that I wouldn't expect from the changes I made, I'm not sure if I don't
> have something wrong in my autotools environment or if perhaps there are some
> differences in how the cygwin versions regenerate?
> 
>   I tested it reasonably thoroughly.  The tests I ran included two of BYTE's nbench
> benchmarks, whetstone and dhrystone, kahan's paranoia, guenther's tramp-3d and
> fourmilabs' fbench.  None showed any differences in results apart from increased
> performance.  (They did reveal some existing problems in our implementation,
> specifically with -ffast-math, but that's for another day).
> 
> 
>   Anyway, here it is.  Subject to whatever you decide about the header prototypes,
> OK?
> 
> 
> newlib/ChangeLog
> 
> 2007-12-18  Dave Korn  <dave.korn@artimi.com>
> 
> 	* libc/include/math.h (llrint, llrintf, rintl, lrintl, llrintl):  Add
> 	prototypes.
> 	* libm/machine/i386/Makefile.am (LIB_SOURCES):  Add new files sf_rint.c,
> 	sf_lrint.c, sf_llrint.c, s_rint.c, s_lrint.c, s_llrint.c, sl_rint.c,
> 	sl_lrint.c and sl_llrint.c.
> 	(lib_a-s_lrint.$(OBJEXT), lib_a-s_rint.$(OBJEXT), lib_a-sf_lrint.$(OBJEXT),
> 	lib_a-sf_rint.$(OBJEXT)):  Add explicit dependencies on common sources
> 	which are directly included by i386 MD implementations when !FAST_MATH.
> 	* libm/machine/i386/Makefile.in:  Regenerated.
> 	* libm/machine/i386/s_llrint.c, libm/machine/i386/s_lrint.c,
> 	libm/machine/i386/s_rint.c, libm/machine/i386/sf_llrint.c,
> 	libm/machine/i386/sf_lrint.c, libm/machine/i386/sf_rint.c,
> 	libm/machine/i386/sl_llrint.c, libm/machine/i386/sl_lrint.c,
> 	libm/machine/i386/sl_rint.c:  New files.
> 
> 
>     cheers,
>       DaveK
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: rint.patch
Type: text/x-patch
Size: 25199 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20071219/92ade155/attachment.bin>


More information about the Newlib mailing list